Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
USB hard drives randomly switch places (sda5, sdb5) reboot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
rrrssssss
n00b
n00b


Joined: 12 Apr 2008
Posts: 41

PostPosted: Fri Apr 25, 2008 8:08 am    Post subject: USB hard drives randomly switch places (sda5, sdb5) reboot Reply with quote

Hello forum,

I installed the automounter software called aufofs to detect all of my drives and partitions and it works beautifully in Gentoo 2007.

But I am having problems with my two USB hard drives swapping places randomly on each reboot according to fdisk-l (sda5 and sdb5). This is causing me to have to frequently edit the auto.auto config file in the autofs automounter in order for the devices to once again match the folder names. I think the order of execution changes for sda5 and sdb5.

Is there a way to stabilize the order of execution of sda5 and sdb5 so they will not randomly swap places during a reboot?

Thank you in advance,
Roy
Back to top
View user's profile Send private message
spOOwn
Apprentice
Apprentice


Joined: 02 Nov 2002
Posts: 259
Location: Belgium

PostPosted: Fri Apr 25, 2008 8:31 am    Post subject: Reply with quote

Put a label on your file system ! I had the same problem once. The kernel take the first available device block.
By the way, you can always attach your usb disk in the same order to keep the same block device if you want !!

If you USB disk partition is of reiser fs type , you would type this :
Code:
# reiserfstune --label my_label /dev/sda5

and replace "my_label" with you own label, but not more than 16 character, otherwise it will be truncate.

If you got an ext3/ext2 file system on it :
Code:
# tune2fs -L my_label /dev/sda5


And in your configuration file of autoload, only specify these label, you could also UUID.
_________________
###########################
# Web site : http://sys-admin.wikidot.com #
###########################
Back to top
View user's profile Send private message
rrrssssss
n00b
n00b


Joined: 12 Apr 2008
Posts: 41

PostPosted: Fri Apr 25, 2008 9:51 am    Post subject: Thank You Reply with quote

Thanks sp00wn,

I was only able to create a label for one of the USB drives since only one of them has ext3. The other USB drive has NTFS.

Will this be enough to keep the devices from switching places? And if not, is there a way to create a lable for NTFS so I can have a label for both USB devices?

Thanks much,
Roy
Back to top
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Fri Apr 25, 2008 1:09 pm    Post subject: Reply with quote

I think there's a way using udev to always give the devices the same names, in case you can't label your ntfs partition. I don't know udev well so alas I can't help further, except to suggest this as a place to look.
Back to top
View user's profile Send private message
spOOwn
Apprentice
Apprentice


Joined: 02 Nov 2002
Posts: 259
Location: Belgium

PostPosted: Fri Apr 25, 2008 1:11 pm    Post subject: Reply with quote

One device wouldn't switch anymore, if you always use the label ( or UUID ) to mount the partition. But the other one could...

It is also possible to put a label on a device with a NTFS file system.
Let's first check if your ntfs device has perhaps already a label :
Code:
 # ntfslabel /dev/sda

if it returns something, this is the label of your ntfs device. Otherwise, you can put your own label with :
Code:
 # ntfslabel /dev/sda my_own_label

_________________
###########################
# Web site : http://sys-admin.wikidot.com #
###########################
Back to top
View user's profile Send private message
rrrssssss
n00b
n00b


Joined: 12 Apr 2008
Posts: 41

PostPosted: Fri Apr 25, 2008 1:25 pm    Post subject: It doesn't work for ntfs Reply with quote

I used ntfslabel from the ntfsprogs package to create a new label for the ntfs USB hard drive but it will not mount using the new label. The command I used to create the label is ntfslabel /dev/sdb5 new-label. I then substituted /dev/sdb5 for LABEL=new-label.

I verified the new label worked by the command ntfslabel /dev/sdb6 and it showed the new label correctly.

The only way to get the ntfs USB HD to mount is to revert back to the old way, /dev/sdb5.

Am I forgetting to do something? The new label works fine for the ext3 USB HD but it will not work for the ntfs USB HD.



Thanks in advance,
Roy
Back to top
View user's profile Send private message
rrrssssss
n00b
n00b


Joined: 12 Apr 2008
Posts: 41

PostPosted: Fri Apr 25, 2008 4:20 pm    Post subject: still trying Reply with quote

If I try to mount /dev/sdb5 in the /mnt directory using the label by typing "mount LABEL=my-label /mnt", I get a message saying "mount: special device LABEL=label does not exist".

But when I type "ntfslabel /dev/sdb5", it says the label is "my-label".

So one says it exists and the other says it does not exist.

I'll keep trying.

Roy
Back to top
View user's profile Send private message
clpalmer
n00b
n00b


Joined: 18 May 2007
Posts: 11
Location: Vancouver, Canada

PostPosted: Fri Apr 25, 2008 7:02 pm    Post subject: Reply with quote

Try mounting by UUID. You can find the UUID of mounted partitions with blkid (or vol_id -u <device>). Mount all your partitions, run blkid to get the UUID's and then replace the /dev/* in your fstab with UUID=<uuid>.
Back to top
View user's profile Send private message
rrrssssss
n00b
n00b


Joined: 12 Apr 2008
Posts: 41

PostPosted: Fri Apr 25, 2008 7:56 pm    Post subject: Reply with quote

The command vol_id was not recognized in my copy of Gentoo but this command was: /bin/ls -lF /dev/disk/by-uuid/ which gives the uuid of /dev/sdb5 as 5600175F00174581 . But I have already tried using that and it didn't work unless I used the wrong format (see below).

Keep in mind that this is for automount (autofs) which does not require any entries in fstab for it to work. Instead, I have to edit the auto.auto file in the /etc/autofs directory. It creates each folder (such as hda-five) on the fly as each drive mounts and the folders disappear when it unmounts. It looks like this:

hda-five -fstype=ext3 :/dev/hda5
hda-six -fstype=ext3 :/dev/hda6
hda-seven -fstype=ext3 :/dev/hda7
hda-eight -fstype=ext3 :/dev/hda8
hda-nine -fstype=ext3 :/dev/hda9
hda-ten -fstype=ext3 :/dev/hda10
hda-eleven -fstype=ext3 :/dev/hda11
hda-twelve -fstype=ext3 :/dev/hda12
secondHD -fstype=ntfs,ro,sync,umask=0022 :/dev/hdb5
secondHD2 -fstype=auto,sync :/dev/hdb6
usb-ext3 -fstype=auto,sync :LABEL=roylabel
usb-ntfs -fstype=ntfs,ro,sync,umask=0022 :LABEL=roy-label
card-reader -fstype=auto,sync :/dev/sdc1

Every drive works perfectly except the usb-ntfs line which is /dev/sdb5.

Maybe I typed the uuid incorrectly in the next to the last line for :LABEL. I tried :UUID= 5600175F00174581 which didn't work. I also tried :LABEL=UUID= 5600175F00174581 which didn't work either.

The funny thing about this is that I can boot into another Linux disribution such as Linux Mint (I have a multi-boot configuration) and the problem drive, sdb5 shows up on the desktop as "roy-label" And it works!. So I think the lable scheme must be working for it to show up there.

But I'll keep trying.

If you can think of any tid bits of information to interject, please do.

Roy
Back to top
View user's profile Send private message
jcat
Veteran
Veteran


Joined: 26 May 2006
Posts: 1337

PostPosted: Sat Apr 26, 2008 8:05 am    Post subject: Reply with quote

If you're having trouble with labels, why not use a udev rule to persistently name the devices as you prefer.

Take a look at these guides.

http://www.reactivated.net/writing_udev_rules.html
and
http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html



Cheers,
jcat
Back to top
View user's profile Send private message
rrrssssss
n00b
n00b


Joined: 12 Apr 2008
Posts: 41

PostPosted: Sun Apr 27, 2008 8:32 pm    Post subject: Problem Solved! Reply with quote

Hello forum,

I solved my problem.

I simply upgraded to the latest version of hal (and its dependencies) and decided to let hal detect my drives and partitions instead of autofs PLUS hal recognizes my labels too. Autofs still can't see my label for NTFS and I still can't mount the label using the mount command in a terminal window. As long as I let hal do the mounting instead of autofs, my labels are recognized and everything works fine.

Hal will also mount all of the drives and partitions even with the proper permissions to the "root owned" USB NTFS hard drive, which is something the older version of hal could not do (Gentoo 2007 CD).

Since Hal is doing such a fine job automounting everything, I don't have any more use for autofs. The only reason I went to autofs is because the lower version of hal was doing such a poor job doing the mounting itself. It didn't mount my partitions and my USB NTFS hard drive could only be accessed as root.

Somebody is doing some mighty fine work writing code for Linux!

Thank you all for your responses,
Roy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum