What is `/dev/sda0`? Is it a standard thing?

While trying to understand this other question, I encountered /dev/sda0 being mentioned.

I have some experience in Linux and I’m used to this scheme where sda, sdb, … are devices and sda1, sda2, … , sdb1, sdb2, … are partitions (each inside the respective device). In this scheme sda0, sdb0, … do not appear. I don’t recall seeing sda0 ever.

Still sda0 appears on U&L SE, on Super User and elsewhere. Where it appears, it almost always seems to be the first partition, i.e. the partition I would expect to appear as sda1 in the scheme I’m used to.

On the other hand in Debian 10 I can see major,minor numbers as 8,1 for sda1, 8,2 for sda2 etc. Thus if anyone asked me what sda0 might be, I would say 8,0 which is already assigned to sda. This reasoning would make sda0 equivalent to sda, the whole device. I guess these numbers are specific to Linux and they may be different in a non-Linux Unix(-like) OS, so the reasoning may not apply there.

In the Internet I have found few appearances of sda0 used as a whole device. The examples are quite obscure though, they may be due to typos or somebody being wrong.

Anyway, the question is: is/was /dev/sda0 a standard thing? If so, what is/was it? (can/could it be a whole device?). Under what circumstances is/was it a standard thing? (e.g. specific OS, some old kernel, specific driver, inside a virtual machine, some obsolete(?) udev config or so).

I’m hoping for answers that will give me enough insight, so the next time I see /dev/sda0 I will be able to tell to myself: ‘Oh, this guy is probably using …’; or maybe: ‘Caution! Custom config ahead’.

Side note: I have also found mentions of /dev/hda0 and a scheme that starts enumerating from hda1. I totally cannot tell if it’s closely related (a parallel) to what I observed for /dev/sda* or just a coincidence.

I’m not aware of /dev/sda0 ever being a standard device name, even on other Unix systems. And as far as I can tell, references to sda0 are likely mistakes rather than indications of a custom setup.

Even in cases where the devices are named in output, users still confuse the numbers. For example, this forum post explicitly lists sda1 to sda3 in the quoted output, yet the title mentions sda0. Similarly, Why are my drives referred to as '(hda0,msdos5)' etc in grub instead of (hda0,5), (hda0,sda5) etc that you usually see? refers to hda0 (which has also never been a standard device name, as far as I know) even though Grub uses hd0 etc.

The Linux kernel publishes the list of device assignments; this describes how partitions are handled:

For partitions, add to the whole disk device number:

Value Device Usage
0 /dev/hd? Whole disk
1 /dev/hd?1 First partition
2 /dev/hd?2 Second partition
63 /dev/hd?63 63rd partition

SCSI disks (/dev/sd?) are handled in the same way:

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

As you can see, there’s no provision for a 0-numbered partition; the “0th” device is the whole disk, represented without a numeric suffix.

(Note that “SCSI disks”, aka sd?, are used for many non-SCSI devices; see Why CentOS converts ATA bus to scsi bus? for some of the history.)

Answered By: Stephen Kitt

I’ve seen this, on a system without udev, one for which mknod would not second-guess you (I used a system for awhile where putting in the wrong major+minor was fixed by makenod somehow), and using the 2.0 kernel; /dev/hda0 was the whole disk device.

The systems I used at the time were various strange floppy-based distros that couldn’t build from source even if you wanted to; I used to mostly use muLinux at the time, but this wasn’t that one and I’d be hard pressed to find it again. I was involved in the community for awhile. The thing about all of these is they were hand-built. There’s no standardization, no upgrade, no package manager, no nothing. The /dev/hda0 device must have come from the guy who built it believing that’s what it should be.

I would be astonished if this bizarre naming convention lived into the udev era.

Answered By: Joshua

It’s not clear whether your question is Linux-specific, but in case not, a FreeBSD system would regard /dev/da0 as the first disk drive on the system, at least for SCSI (and USB) drives, and perhaps other drive types where the device driver presents the device as a SCSI-like unit. ATA/SATA (and historically, ATAPI) drives would be /dev/adaN, where N >= 0.

Note that /dev/da0 is a full-drive device, not a partition device. Subdivisions of unit 0 would be /dev/da0sX for MBR slices (X>=1), or /dev/da0pX (X>=1) for GPT partitions.

DA is a mnemonic for a Direct Access device, or random access, in that any block of the device is equally addressable. In contrast, FreeBSD uses sa device driver nodes of the form /dev/saN for Sequential Access devices, e.g. tape drives.

Answered By: Jim L.

The short answer is no. The interface promises between kernel and userspace does not include the device numbers. it may be any numerical value and may even differ when you reboot to a newer kernel. Therefore you should never rely on them.

Answered By: Cristian Rodríguez