Joseph Hesse
2013-Jul-04 15:46 UTC
[CentOS] sda and sdb reverse order with an external USB drive
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 ======================================================================================= 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 at 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,mode=620) 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 at 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,mode=620) 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 UUID=1d7606b7-46b8-4b29-9a4e-a50a1f6a1759 / ext4 defaults 1 1 UUID=e0fdfeb1-e7a7-4a06-b5fa-7730c3c2e60d /boot ext4 defaults 1 2 UUID=d0e3c2ee-7c66-4d13-b387-1da958020b1a swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 #UUID=3b550884-8d05-41a5-a205-17b6d7269dd1 /mnt ext3 rw,suid,dev,exec,noauto,nouser,async 0 2
Jay Leafey
2013-Jul-04 17:58 UTC
[CentOS] sda and sdb reverse order with an external USB drive
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