< Day Day Up > |
Recipe 9.12. Finding Device Names for mount and fstab9.12.1 ProblemYou want to mount a storage disk, such as an IDE or SCSI hard drive, CD, DVD, USB storage device, or Zip disk. You don't know what device name to use—where do you look? 9.12.2 SolutionUse dmesg and fdisk. dmesg finds device names, and fdisk shows the partition numbers on hard drives. Referring to http://www.lanana.org/docs/device-list/devices.txt can be helpful as well, as it is the list of official /dev names. (If you have kernel sources installed, the devices.txt file may be present on your system in the /usr/src/* directory.) This command searches dmesg for CD drives: $ dmesg | grep -i cd
hdc: ATAPI CDROM, ATAPI CD/DVD-ROM DRIVE
hdc: ATAPI 40X CD-ROM DRIVE, 128K cache, UDMA (33) A quick search in devices.txt reveals Second IDE hard disk/CD-ROM interface 0 = /dev/hdc Master: whole disk (or CD-ROM) Ignore the 0 = part; your device name is /dev/hdc. This is what CD drives using the IDE-SCSI subsystem look like: $ dmesg | grep -i cd
hdb: TOSHIBA DVD-ROM SD-M1202, ATAPI CD/DVD-ROM drive
hdc: LITE-ON LTR-24102B, ATAPI CD/DVD-ROM drive
ide-cd: ignoring drive hdb
ide-cd: ignoring drive hdc
Type: CD-ROM ANSI SCSI revision: 02
Type: CD-ROM ANSI SCSI revision: 02
Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
Attached scsi CD-ROM sr1 at scsi0, channel 0, id 1, lun 0
scd0: scsi3-mmc drive: 32x/32x cd/rw xa/form2 cdda tray
Uniform CD-ROM driver Revision: 3.12
scd1: scsi3-mmc drive: 131x/40x writer cd/rw xa/form2 cdda tray So the drive names are /dev/scd0 and /dev/scd1. With hard drives, you must select specific partitions, since each partition is a separate block device. fdisk -l displays all partitions on all detected hard drives: # /sbin/fdisk -l
Disk /dev/hda: 20.5 GB, 20576747520 bytes
255 heads, 63 sectors/track, 2501 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 893 7172991 7 HPFS/NTFS
/dev/hda2 894 1033 1124550 c W95 FAT32 (LBA)
/dev/hda4 1034 2501 11791710 f W95 Ext'd (LBA)
/dev/hda5 2437 2501 522081 82 Linux swap
/dev/hda6 1034 1670 5116639+ 83 Linux
/dev/hda7 1671 2436 6152863+ 83 Linux
Partition table entries are not in disk order Copy the device name from the Device column exactly as it is shown. This is what a USB pen drive looks like in dmesg: hub.c: new USB device 00:1d.0-2.3, assigned address 5 usb.c: USB device 5 (vend/prod 0x1915/0x2220) is not claimed ... SCSI device sda: 128000 512-byte hdwr sectors (66 MB) sda: Write Protect is off sda: sda1 Your device name is /dev/sda1. This how fdisk sees USB drives: # fdisk -l
Disk /dev/sda: 65 MB, 65536000 bytes
8 heads, 32 sectors/track, 500 cylinders
Units = cylinders of 256 * 512 = 131072 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 499 63856 6 FAT16 9.12.3 DiscussionAll storage devices are block devices in /dev. /dev names them according to their physical connections. For example:
Storage devices on Linux follow this naming convention:
IDE and USB devices that use the SCSI emulation subsystem are sometimes named /dev/sr*, which is symlinked to /dev/sd*. If you have kernel sources installed, look for the devices.txt file to see the definitions of all those /dev names. 9.12.4 See Also
|
< Day Day Up > |