[ Pobierz całość w formacie PDF ]
.This prob-lem was solved by the advent of the printer buffer, a device containing someRAM memory that would sit between the computer and the printer.With theprinter buffer in place, the computer would send the printer output to the bufferand it would quickly be stored in the fast RAM so the computer could go back towork without waiting.Meanwhile, the printer buffer would slowly spool the datato the printer from the buffer's memory at the speed at which the printer could ac-cept it.181 15  Storage MediaThis idea of buffering is used extensively in computers to make them faster.Don'tlet the need to occasionally read or write data to or from slow devices impede thespeed of the system.Operating systems store data that has been read from, and isto be written to storage devices in memory for as long as possible before actuallyhaving to interact with the slower device.On a Linux system for example, youwill notice that the system seems to fill up memory the longer it is used.This doesnot mean Linux is  using all the memory, it means that Linux is taking advan-tage of all the available memory to do as much buffering as it can.This buffering allows writing to storage devices to be done very quickly, becausethe writing to the physical device is being deferred to a future time.In the mean-time, the data destined for the device is piling up in memory.From time to time,the operating system will write this data to the physical device.Unmounting a device entails writing all the remaining data to the device so that itcan be safely removed.If the device is removed without unmounting it first, thepossibility exists that not all the data destined for the device has been transferred.In some cases, this data may include vital directory updates, which will lead tofile system corruption, one of the worst things that can happen on a computer.Determining Device NamesIt's sometimes difficult to determine the name of a device.Back in the old days, it wasn'tvery hard.A device was always in the same place and it didn't change.Unix-like systemslike it that way.Back when Unix was developed,  changing a disk drive involved usinga forklift to remove a washing machine-sized device from the computer room.In recentyears, the typical desktop hardware configuration has become quite dynamic and Linuxhas evolved to become more flexible than its ancestors.In the examples above we took advantage of the modern Linux desktop's ability to  au-tomagically mount the device and then determine the name after the fact.But what if weare managing a server or some other environment where this does not occur? How canwe figure it out?First, let's look at how the system names devices.If we list the contents of the /dev di-rectory (where all devices live), we can see that there are lots and lots of devices:[me@linuxbox ~]$ ls /devThe contents of this listing reveal some patterns of device naming.Here are a few:182 Mounting And Unmounting Storage DevicesTable 15-2: Linux Storage Device NamesPattern Device/dev/fd*Floppy disk drives./dev/hd*IDE (PATA) disks on older systems.Typical motherboardscontain two IDE connectors or channels, each with a cable withtwo attachment points for drives.The first drive on the cable iscalled the master device and the second is called the slavedevice.The device names are ordered such that /dev/hdarefers to the master device on the first channel, /dev/hdb is theslave device on the first channel; /dev/hdc, the master deviceon the second channel, and so on.A trailing digit indicates thepartition number on the device.For example, /dev/hda1 refersto the first partition on the first hard drive on the system while/dev/hda refers to the entire drive./dev/lp*Printers./dev/sd*SCSI disks.On recent Linux systems, the kernel treats all disk-like devices (including PATA/SATA hard disks, flash drives, andUSB mass storage devices such as portable music players, anddigital cameras) as SCSI disks.The rest of the naming system issimilar to the older /dev/hd* naming scheme described above./dev/sr*Optical drives (CD/DVD readers and burners).In addition, we often see symbolic links such as /dev/cdrom, /dev/dvd, and/dev/floppy, which point to the actual device files, provided as a convenience.If you are working on a system that does not automatically mount removable devices,you can use the following technique to determine how the removable device is namedwhen it is attached.First, start a real-time view of the /var/log/messages or/var/log/syslog file (you may require superuser privileges for this):[me@linuxbox ~]$ sudo tail -f /var/log/messagesThe last few lines of the file will be displayed and then pause.Next, plug in the remov-able device.In this example, we will use a 16 MB flash drive.Almost immediately, thekernel will notice the device and probe it:183 15  Storage MediaJul 23 10:07:53 linuxbox kernel: usb 3-2: new full speed USB deviceusing uhci_hcd and address 2Jul 23 10:07:53 linuxbox kernel: usb 3-2: configuration #1 chosenfrom 1 choiceJul 23 10:07:53 linuxbox kernel: scsi3 : SCSI emulation for USB MassStorage devicesJul 23 10:07:58 linuxbox kernel: scsi scan: INQUIRY result too short(5), using 36Jul 23 10:07:58 linuxbox kernel: scsi 3:0:0:0: Direct-Access EasyDisk 1 [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • ciaglawalka.htw.pl