Sda And Sdb Reverse Order With An External USB Drive

Home » CentOS » Sda And Sdb Reverse Order With An External USB Drive
CentOS 1 Comment

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.

=======================================================================================
The following mount command was issued by first completely booting CentOS and then inserting the external USB Drive. Note the sda3 is / and sda1 is /boot.

[root@XoticPC ~]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,modeb0)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdb1 on /media/GoFlex type ext3 (rw,nosuid,nodev,uhelper=udisks)

=======================================================================================
The following mount command was issued by inserting the external USB drive in a powered down computer and then booting. Note the sdb3 is / and sdb1 is /boot.

[root@XoticPC ~]# mount
/dev/sdb3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,modeb0)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sdb1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sda1 on /media/GoFlex type ext3 (rw,nosuid,nodev,uhelper=udisks)

=======================================================================================
The /etc/fstab file was generated by the install process. The commented line at the bottom was added by me in an unsuccessful attempt to be able to insert the USB drive in a booted computer, not having it mount, and then control the mounting with “# mount /mnt”. The last UUID is the UUID of sdb1 determined with the command “# blkid
/dev/sdb1”.

# /etc/fstab UUID7606b7-46b8-4b29-9a4e-a50a1f6a1759 / ext4 defaults 1 1 UUID

One thought on - Sda And Sdb Reverse Order With An External USB Drive

  • 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=” 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!

LEAVE A COMMENT