How are Linux drives named beyond drive 26 (/dev/sdz, ..)?

[Edit: Thanks to adrianmonk for correcting my math]

It’s surprisingly hard to find a definitive answer to the question of what happens with Linux block device names when you get past drive 26 (ie. counting from one, the first disk is /dev/sda and the 26th disk is /dev/sdz, what comes next?) I need to find out because libguestfs is currently limited to 25 disks, and this really needs to be fixed.

Anyhow, looking at the code we can see that it depends on which driver is in use.

For virtio-blk (/dev/vd*) the answer is:

Drive # — Name
1 vda
26 vdz
27 vdaa
28 vdab
52 vdaz
53 vdba
54 vdbb
702 vdzz
703 vdaaa
704 vdaab
18278 vdzzz

Beyond 18278 drives the virtio-blk code would fail, but that’s not currently an issue.

For SATA and SCSI drives under a modern Linux kernel, the same as above applies except that the code to derive names works properly beyond sdzzz up to (in theory) sd followed by 29 z‘s! [Edit: or maybe not?]

As you can see virtio and SCSI/SATA don’t use common code to name disks. In fact there are also many other block devices in the kernel, all using their own naming scheme. Most of these use numbers instead of letters: eg: /dev/loop0, /dev/ram0, /dev/mmcblk0 and so on.

If disks are partitioned, then the partitions are named by adding the partition number on the end (counting from 1). But if the drive name already ends with a number then a letter p is added between the drive name and the partition number, thus: /dev/mmcblk0p1.

About these ads

5 Comments

Filed under Uncategorized

5 responses to “How are Linux drives named beyond drive 26 (/dev/sdz, ..)?

  1. In my humble laymans opinion this should be organized better. I doubt the BSD systems have guidelines for it but I like how they simply accepted the fact that driver authors will name their own devices, whether it be storage or network interface cards.

    Because it’s either this, or you have the kernel do it for them with Linux made facilities, and clearly this is not the case, so why linger inbetween Linux?

    I’m not trying to be overly critical towards Linux, I just feel that when you’re dealing with OSS all things possible should be done to ease reading and writing of said code. Remove confusing factors if you will.

  2. Kint

    I guess something like this?

    # dmesg | grep “Attached scsi disk”
    Attached scsi disk sda at scsi0, channel 0, id 0, lun 1
    Attached scsi disk sdb at scsi0, channel 0, id 0, lun 2
    Attached scsi disk sdc at scsi0, channel 0, id 0, lun 3
    Attached scsi disk sdd at scsi0, channel 0, id 0, lun 4
    Attached scsi disk sde at scsi0, channel 0, id 0, lun 5
    Attached scsi disk sdf at scsi0, channel 0, id 0, lun 6
    Attached scsi disk sdg at scsi0, channel 0, id 0, lun 7
    Attached scsi disk sdh at scsi0, channel 0, id 0, lun 8
    Attached scsi disk sdi at scsi0, channel 0, id 0, lun 9
    Attached scsi disk sdj at scsi0, channel 0, id 0, lun 10
    Attached scsi disk sdk at scsi0, channel 0, id 0, lun 11
    Attached scsi disk sdl at scsi0, channel 0, id 0, lun 12
    Attached scsi disk sdm at scsi0, channel 0, id 0, lun 13
    Attached scsi disk sdn at scsi0, channel 0, id 0, lun 14
    Attached scsi disk sdo at scsi0, channel 0, id 0, lun 15
    Attached scsi disk sdp at scsi0, channel 0, id 0, lun 16
    Attached scsi disk sdq at scsi0, channel 0, id 0, lun 17
    Attached scsi disk sdr at scsi0, channel 0, id 0, lun 18
    Attached scsi disk sds at scsi0, channel 0, id 0, lun 19
    Attached scsi disk sdt at scsi0, channel 0, id 0, lun 20
    Attached scsi disk sdu at scsi0, channel 0, id 0, lun 21
    Attached scsi disk sdv at scsi0, channel 0, id 0, lun 22
    Attached scsi disk sdw at scsi0, channel 0, id 0, lun 23
    Attached scsi disk sdx at scsi0, channel 0, id 0, lun 24
    Attached scsi disk sdy at scsi0, channel 0, id 0, lun 25
    Attached scsi disk sdz at scsi0, channel 0, id 0, lun 26
    Attached scsi disk sdaa at scsi0, channel 0, id 0, lun 27
    Attached scsi disk sdab at scsi0, channel 0, id 0, lun 28
    Attached scsi disk sdac at scsi0, channel 0, id 0, lun 29
    Attached scsi disk sdad at scsi0, channel 0, id 0, lun 30
    Attached scsi disk sdae at scsi0, channel 0, id 0, lun 31
    Attached scsi disk sdaf at scsi0, channel 0, id 0, lun 32
    Attached scsi disk sdag at scsi0, channel 0, id 0, lun 33
    Attached scsi disk sdah at scsi0, channel 0, id 0, lun 34
    Attached scsi disk sdai at scsi0, channel 0, id 0, lun 35
    Attached scsi disk sdaj at scsi1, channel 0, id 0, lun 1
    Attached scsi disk sdak at scsi1, channel 0, id 0, lun 2
    Attached scsi disk sdal at scsi1, channel 0, id 0, lun 3
    Attached scsi disk sdam at scsi1, channel 0, id 0, lun 4
    Attached scsi disk sdan at scsi1, channel 0, id 0, lun 5
    Attached scsi disk sdao at scsi1, channel 0, id 0, lun 6
    Attached scsi disk sdap at scsi1, channel 0, id 0, lun 7
    Attached scsi disk sdaq at scsi1, channel 0, id 0, lun 8
    Attached scsi disk sdar at scsi1, channel 0, id 0, lun 9
    Attached scsi disk sdas at scsi1, channel 0, id 0, lun 10
    Attached scsi disk sdat at scsi1, channel 0, id 0, lun 11
    Attached scsi disk sdau at scsi1, channel 0, id 0, lun 12
    Attached scsi disk sdav at scsi1, channel 0, id 0, lun 13
    Attached scsi disk sdaw at scsi1, channel 0, id 0, lun 14
    Attached scsi disk sdax at scsi1, channel 0, id 0, lun 15
    Attached scsi disk sday at scsi1, channel 0, id 0, lun 16
    Attached scsi disk sdaz at scsi1, channel 0, id 0, lun 17
    Attached scsi disk sdba at scsi1, channel 0, id 0, lun 18
    Attached scsi disk sdbb at scsi1, channel 0, id 0, lun 19
    Attached scsi disk sdbc at scsi1, channel 0, id 0, lun 20
    Attached scsi disk sdbd at scsi1, channel 0, id 0, lun 21
    Attached scsi disk sdbe at scsi1, channel 0, id 0, lun 22
    Attached scsi disk sdbf at scsi1, channel 0, id 0, lun 23
    Attached scsi disk sdbg at scsi1, channel 0, id 0, lun 24
    Attached scsi disk sdbh at scsi1, channel 0, id 0, lun 25
    Attached scsi disk sdbi at scsi1, channel 0, id 0, lun 26
    Attached scsi disk sdbj at scsi1, channel 0, id 0, lun 27
    Attached scsi disk sdbk at scsi1, channel 0, id 0, lun 28
    Attached scsi disk sdbl at scsi1, channel 0, id 0, lun 29
    Attached scsi disk sdbm at scsi1, channel 0, id 0, lun 30
    Attached scsi disk sdbn at scsi1, channel 0, id 0, lun 31
    Attached scsi disk sdbo at scsi1, channel 0, id 0, lun 32
    Attached scsi disk sdbp at scsi1, channel 0, id 0, lun 33
    Attached scsi disk sdbq at scsi1, channel 0, id 0, lun 34
    Attached scsi disk sdbr at scsi1, channel 0, id 0, lun 35

  3. Christopher Lunsford

    Great article! I can’t believe that I have the potential for over 18 thousand drives lol!

  4. Pingback: What happens if you have 27 drives?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s