Linux – What are all those ‘sd’ devices in /proc/devices

deviceslinuxproc

The /proc/devices file lists devices by major revision number and name. On my system it shows (partially):

Block devices:
259 blkext
  7 loop
  8 sd
  9 md
 11 sr
 65 sd
 66 sd
 67 sd
 68 sd
 69 sd
 70 sd
 71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
253 device-mapper
254 mdp

What are all those 'sd' devices? The first one (rev. no. 8) is probably /dev/sda but the rest of them don't show up in /dev – there are no devices with those major revision numbers.

I do see a list of devices:

crw-rw---- 1 root tty       7, 128 Jul 29 14:15 vcsa
crw-rw---- 1 root tty       7, 129 Jul 29 14:15 vcsa1
crw-rw---- 1 root tty       7, 130 Jul 29 14:15 vcsa2
crw-rw---- 1 root tty       7, 131 Jul 29 14:15 vcsa3
crw-rw---- 1 root tty       7, 132 Jul 29 14:15 vcsa4
crw-rw---- 1 root tty       7, 133 Jul 29 14:15 vcsa5
crw-rw---- 1 root tty       7, 134 Jul 29 14:15 vcsa6

where the minor number might be a match – would /proc show minor revision numbers, and why are they called sd. Either way, I don't see any device with no. 135.

Could someone explain this to me?

Best Answer

The first disk /dev/sda is 8:0 (major:minor), but the major number 8 contains the next 15 disks too (Documentation/devices.txt in the kernel source):

  8 block       SCSI disk devices (0-15)
                  0 = /dev/sda          First SCSI disk whole disk
                 16 = /dev/sdb          Second SCSI disk whole disk
                 32 = /dev/sdc          Third SCSI disk whole disk
                    ...
                240 = /dev/sdp          Sixteenth SCSI disk whole disk

                Partitions are handled in the same way as for IDE
                disks (see major number 3) except that the limit on
                partitions is 15.

The rest are for the rest of your drives (major numbers 66-71 and 128-134 are similar, and the partitioning scheme is the same for all of them):

 65 block       SCSI disk devices (16-31)
                  0 = /dev/sdq          17th SCSI disk whole disk
                 16 = /dev/sdr          18th SCSI disk whole disk
                    ...


135 block       SCSI disk devices (240-255)
                  0 = /dev/sdig         241st SCSI disk whole disk
                    ...
                240 = /dev/sdiv         256th SCSI disk whole disk

Well, you probably don't have that many disks, and the system only generates the nodes that are required for the devices you actually have, so you don't see anything but sda and its partitions in /dev.


As for vcsa and friends, they're related to the virtual consoles:

  7 char        Virtual console capture devices
                  0 = /dev/vcs          Current vc text contents
                  1 = /dev/vcs1         tty1 text contents
                    ...
                128 = /dev/vcsa         Current vc text/attribute contents
                129 = /dev/vcsa1        tty1 text/attribute contents
                    ...

Also note that /dev/vcs* are character devices, not a block devices. The first letter in the ls output tells which one it is.

Related Question