[CentOS] sda and sdb reverse order with an external USB drive

Jay Leafey jay.leafey at mindless.com
Thu Jul 4 17:58:55 UTC 2013


On 07/04/2013 10:46 AM, Joseph Hesse wrote:
> Hello
>
> I am using 64 bit CentOS 6.4 on an i7 laptop with one sata drive and a
> CD drive.
> I installed CentOS by manually partitioning sda as:
> sda1 as /boot, sda2 as swap, sda3 as /.
> The booted system works great.
>
> When I insert an external USB drive, formatted as ext3, the hard drive
> on the laptop and the
> USB drive are either sda or sdb, depending upon the order on which I
> insert the USB drive
> and boot the system.  Please see the two mount commands below for each
> of these situations.
>
> This seems to work in either order except for the fact that I don't want
> my USB drive to automount.
>
> What I want is that after I insert the USB drive in a running system and
> wait 15 seconds, I want to
> mount the USB drive with the command "# mount /mnt".  To accomplish this
> I added a line to /etc/fstab but it didn't work.
> When I uncomment the last line in fstab (see below) the computer hangs
> and doesn't boot.  I was successful with this strategy on a
> similar laptop with Fedora 18 but not my current one.
>
> Thank you,
> Joe Hesse
>

I have had similar issues in the past.  The take-away is that you cannot 
depend on device names being stable, it depends on the order in which 
devices are enumerated at boot time.

In my case, an eSATA drive shows up as the first device if it is turned 
on when the system boots.  It apparently enumerates as sda and the rest 
of the drives are bumped up one drive letter.  The system boots OK, but 
the drive letters are different.

When I want to mount the external drive I use "LABEL=".  When I 
formatted the external drive I specified a filesystem label and rather 
than specifying "/dev/sdb1" in my fstab I used "LABEL=fslabel".  That 
way it doesn't matter what device name comes up, it mounts the 
filesystem by that label.  The label can be added after-the-fact using 
tune2fs or the appropriate tool for the on-disk format.  You can also 
use "UUID=<uuid>" if you prefer to use UUIDs.  See the "mount" manpage 
for more information.

Of course, I could be wrong about what you are trying to accomplish, but 
I think it might be applicable.  YMMV!
-- 
Jay Leafey - jay.leafey at mindless.com
Memphis, TN



More information about the CentOS mailing list