/dev/sda and /dev/hda

Rick Stevens rstevens at internap.com
Wed Oct 24 00:42:39 UTC 2007


On Tue, 2007-10-23 at 18:31 -0600, Karl Larsen wrote:
> Rick Stevens wrote:
> > On Tue, 2007-10-23 at 17:50 -0600, Karl Larsen wrote:
> >   
> >> Rick Stevens wrote:
> >>     
> >>> On Tue, 2007-10-23 at 17:13 -0600, Karl Larsen wrote:
> >>>   
> >>>       
> >>>>     As I have been working with 2 hard drives I have discovered for 
> >>>> certain that both hard drives change to /dev/sda when a partition on 
> >>>> them is booted. It happens that one is found at /dev/sdf and the other 
> >>>> is found at /dev/sdb. This leads to confusion and in my case I am not 
> >>>> sure what to think.
> >>>>
> >>>>     Is this changing the disk drives a feature or is it a bug? If not a 
> >>>> feature I will write a bug soon.
> >>>>
> >>>>     I understand the /dev/hda stays the first hard drive.
> >>>>     
> >>>>         
> >>> Well, sorta.  Depends on the kernel you're booting.  On earlier kernels
> >>> (pre-F7), IDE drives remained /dev/hdX.  Under F7 and later kernels,
> >>> ALL block storage is treated as SCSI (/dev/sdX) regardless of how it's
> >>> physically connected.  There's no differentiation at that level (there
> >>> is in sysfs, but let's not go there right now).
> >>>
> >>> If you have other devices that were treated as SCSI before (USB, SATA,
> >>> whatever), your IDE stuff now gets added to the mix and the names can
> >>> change.  You also have to remember that grub uses a TOTALLY DIFFERENT
> >>> drive naming convention than a Linux kernel does.
> >>>
> >>> Also note that in the Linux kernels, /dev/sdX refers to the ENTIRE
> >>> drive--not a partition on the drive.  /dev/sda is the first SCSI
> >>> disk (the ENTIRE disk), /dev/sda2 is the second partition on the first
> >>> SCSI disk.
> >>>   
> >>>       
> >>     I'm sorry but you are avoiding the question. I say /dev/sdf changes 
> >> to /dev/sda when booted. Is this a feature or a Bug?
> >>     
> >
> > I didn't mean to.  How did you determine it was /dev/sdf first if the
> > system hadn't booted?  I think I'm missing something here.
> >
> > Note also that different kernels may scan the buses in different orders
> > which may move things on you.  The same kernel on different hardware can
> > do different things as well.  For example, on Dell 1850s with NICs in
> > the PCI slots, the PCI slot NICs get eth0 and eth1, the mobo NICs get
> > eth2 and eth3.  On 2850s, the mobo NICs get eth0 and eth1 and the PCI
> > NICs get eth2 and eth3.
> >
> > Ah, consistency!
> >
>     OK again. If I run fdisk from hd 1 which is booted I find hd 2 is at 
> /dev/sdf and hd 1 is at /dev/sda. If I boot from hd2  I find it is at 
> /dev/sda now and hd1 has changed to /dev/sdb.
> 
>      Is this a feature or a Bug?

Ah!  I'd expect that.  The kernel will generally say that the drive that
contains / (the root) will be the first drive (/dev/sda).  Where the
other drives end up depends on how fast the drives spin up and go ready,
the order the buses are scanned, etc. and as I said, that can vary from
kernel to kernel.

When you boot the second drive, it becomes /dev/sda (since / is on THAT
drive), hd1 is seen before other drives go ready/are scanned, etc. and
becomes /dev/sdb.

Yes, it's confusing.

----------------------------------------------------------------------
- Rick Stevens, Principal Engineer             rstevens at internap.com -
- CDN Systems, Internap, Inc.                http://www.internap.com -
-                                                                    -
- Do not taunt the sysadmins, for they are subtle and quick to anger -
----------------------------------------------------------------------




More information about the fedora-list mailing list