Linux device naming
This topic provides information to help you understand naming patterns for devices on Linux.
Special device files are used by kernel drivers to control a device. There can be more than one special device file that maps to the same physical device. For example, in a multipath environment with four paths to the same device, four different device files will map to the same physical device.
The device files are located in the /dev directory and are addressed by a major and minor number pair. Fibre Channel attached devices are managed as SCSI disk devices by the sd driver. Thus, each of the attached storage unit LUNs has a special device file in the Linux directory /dev.
SCSI disk devices have special device files that start with an ‘sd’ prefix, and have the following naming format:
- /dev/sd[a-z][a-z][1-15]
Names without a trailing digit refer to the whole disk, while names with a trailing digit refer to a partition of that whole disk. By convention, SCSI disks have a maximum of 16 minor numbers mapped to a single disk. Thus, for each whole disk, there is a maximum of 15 partitions per disk because one minor number is used to describe the entire disk (for example /dev/sda), and the other 15 minor numbers are used to refer to partitions for that disk (for example /dev/sda1, /dev/sda2, etc). The following example displays the device files for the whole disk /dev/sda, which has a major number of 8 and a minor number of 0, and its 15 partitions.
brw-rw---- 1 root disk 8, 0 May 24 08:09 /dev/sda
brw-rw---- 1 root disk 8, 1 May 24 08:09 /dev/sda1
brw-rw---- 1 root disk 8, 10 May 24 08:09 /dev/sda10
brw-rw---- 1 root disk 8, 11 May 24 08:09 /dev/sda11
brw-rw---- 1 root disk 8, 12 May 24 08:09 /dev/sda12
brw-rw---- 1 root disk 8, 13 May 24 08:09 /dev/sda13
brw-rw---- 1 root disk 8, 14 May 24 08:09 /dev/sda14
brw-rw---- 1 root disk 8, 15 May 24 08:09 /dev/sda15
brw-rw---- 1 root disk 8, 2 May 24 08:09 /dev/sda2
brw-rw---- 1 root disk 8, 3 May 24 08:09 /dev/sda3
brw-rw---- 1 root disk 8, 4 May 24 08:09 /dev/sda4
brw-rw---- 1 root disk 8, 5 May 24 08:09 /dev/sda5
brw-rw---- 1 root disk 8, 6 May 24 08:09 /dev/sda6
brw-rw---- 1 root disk 8, 7 May 24 08:09 /dev/sda7
brw-rw---- 1 root disk 8, 8 May 24 08:09 /dev/sda8
brw-rw---- 1 root disk 8, 9 May 24 08:09 /dev/sda9
For Red Hat, the kernel automatically creates the device files for 128 devices. For SUSE, there are only special device files for the first 16 disks. You must create the device files for additional disks by using the mknod command. For 2.6 kernels, the special device files are only created when they are detected and recognized by the kernel. The /proc/partitions file lists all the ‘sd’ devices that are recognized by the SCSI disk driver, including the sd name, major number, minor number, and size of each disk device.
The following is an example /proc/partitions file:
major minor #blocks name
8 0 17774160 sda
8 1 1052226 sda1
8 2 208845 sda2
8 3 10490445 sda3
8 16 976576 sdb
8 32 976576 sdc
8 48 976576 sdd
8 64 976576 sde
8 80 976576 sdf
8 96 976576 sdg
8 112 976576 sdh
8 128 976576 sdi
8 144 976576 sdj
8 160 976576 sdk
8 176 976576 sdl
8 192 976576 sdm
8 208 976576 sdn
8 224 976576 sdo
8 240 976576 sdp
65 0 976576 sdq
65 16 1048576 sdr
65 32 1048576 sds
65 48 1048576 sdt
65 64 1048576 sdu
65 80 1048576 sdv
65 96 1048576 sdw
65 112 1048576 sdx
65 128 1048576 sdy
65 144 1048576 sdz
65 160 1048576 sdaa
65 176 1048576 sdab
65 192 1048576 sdac
65 208 1048576 sdad
65 224 1048576 sdae
65 240 1048576 sdaf
66 0 1048576 sdag
66 16 1048576 sdah
66 32 1048576 sdai
66 48 1048576 sdaj
66 64 1048576 sdak
66 80 1048576 sdal
66 96 1048576 sdam
66 112 1048576 sdan
66 128 1048576 sdao
66 144 1048576 sdap
66 160 1048576 sdaq
66 176 1048576 sdar
66 192 1048576 sdas
66 208 1048576 sdat
66 224 1048576 sdau
66 240 1048576 sdav
0 comments :
Post a Comment