Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the hard disk drive/device partition naming convention in Linux? For example, [hd0,0], sd0, etc. What does it actually mean?

What is the significance of this when i need to install multiple OSes on the same machine?

How can we relate it to windows partitioning (example: C:\ drive or D:\ drive)?

share|improve this question
2  
Cross posted to askubuntu.com: askubuntu.com/questions/7575/… –  Steven D Oct 15 '10 at 17:58
add comment

3 Answers

up vote 5 down vote accepted

The convention changes depending on what you're looking at; hd0,0 looks similar to GRUB, while sd0 is similar to entries in /dev, but neither matches what I normally see.

In /dev:

  • IDE drives start with hd, while SATA (and I believe any kind of serial device) start with sd
  • Drives are lettered starting with a in cable order, so /dev/sda is the first serial drive, and /dev/hdb is the second IDE drive
  • Partitions on a drive are numbered starting with 1, so /dev/sdb1 is the first partition on the second serial drive

GRUB 1 doesn't have the distinction between drive types, it's always of the form (hdX, Y):

  • X is the number of the drive, starting with 0, so sda is hd0, sdb is hd1, etc.
  • Y is the number of the partition, starting with 0 (not 1 like /dev), so sda1 is (hd0, 0)

I believe GRUB 2 uses a different syntax, but I don't know it


It's significant when you're installing multiple OSes if you want to put them on separate partitions -- you need to keep track of which OS is where. It's really significant anytime you're dealing with unmounted drives; you need to know that / is on /dev/sda1 and /home is on /dev/sda2 (for example)

As far as I know, Windows disks start from disk 0, and partitions don't have any particular numbering. Drive letters are assigned however you like and not tied to a particular partition

share|improve this answer
    
Grub 2 works like Grub 1 only the number of the partition starts with 1. –  fschmitt Oct 15 '10 at 19:03
    
Also one should note, that some IDE drives show up as /dev/sdX, too. This depends on the chipset and its drivers. –  fschmitt Oct 15 '10 at 19:04
    
Thanks you very much –  Renjith G Oct 15 '10 at 20:36
    
I should point out that on modern systems, the enumeration is not cable order but order of autodetection by udev. This poses quite a problem, because sometimes the order gets mixed up. This is why you should always mount either by label or by UUID (the first is set by user and the second is guaranteed not to change unless you reformat your partition). You can also influence the enumeration by writing udev rules - you could assign your own names if you wanted. –  orion Mar 17 at 16:51
add comment

(hd0,0) is Grub syntax. (Note that these are parentheses, not square brackets.) Grub is a bootloader, that is, a small program that is launched by your computer's BIOS and whose job is to load the operating system. hd0 references the first drive detected by the BIOS, hd1 references the second one. The second number is a partition number; Grub 1 starts from 0, while Grub 2 starts from 1. See “Naming convention” in the Grub manual if you want more details.

/dev/sda, /dev/sdb, etc, are the default names of hard disks (and other similar storage like flash disks of all kinds, but not CD or tape drives) under Linux. The last letter grows in the order in which the disks are detected. You may find /dev/hda, /dev/hdb, etc, on some Linux distributions. sd indicates that the disk driver uses a SCSI interface internally, while hd indicates that the driver uses an IDE interface. This is only an internal kernel matter, you can and often do have IDE disks appear as sd. The additional number is the partition number, starting at 1.

The partitions you're likely to encounter follow the PC partitioning scheme. A disk has up to four primary partitions, numbered 1 to 4 (or 0 to 3 in Grub 1). It may also have any number of logical partitions, in which case one of the primary partitions cannot contain a filesystem but must instead be an extended partition (a container for the logical partitions). Logical partitions are numbered from 5 on (from 4 in Grub 1).

The names of the device files (e.g. /dev/sda) used by Linux are in fact assigned by the udev program, and can be configured. This is typically useful in advanced situations involving removable media.

Most of the time, you don't need to care about device names. They are referenced in a very small number of places, typically only two: the bootloader configuration (as we've seen, Grub has its own names anyway), and the file /etc/fstab which lists the filesystems to mount on boot. (And even /etc/fstab does not always reference partitions by names like /dev/sda1.) What matters is mount points, that is, the location (directory) at which each filesystem is mounted.

Windows uses a completely different naming scheme which is hard to relate to the underlying hardware structure. c:, d:, etc, are assigned to partitions of a type that Windows recognizes in a particular order (and there are ways to influence this order). Wikipedia has the details.

share|improve this answer
    
Thanks you very much –  Renjith G Oct 15 '10 at 20:41
add comment

On my slackware box, /dev/hda is the first hard drive detected.
/dev/hda1 and /dev/hda2 are the first two partitions.

I can use fdisk to see the partitions.

/dev/hda1               1         124      995998+  82  Linux swap
/dev/hda2   *         125        1662    12353985   83  Linux

On my fedora box, /dev/sda is the first hard drive detected.
/dev/sda1 and /dev/sda2 would be the first two partitions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.