How to consistently mount USB HDD's at same mountpoints?

Forum rules
Before you post please read this
Post Reply
silentstone
Level 1
Level 1
Posts: 16
Joined: Tue Apr 24, 2007 7:46 am

How to consistently mount USB HDD's at same mountpoints?

Post by silentstone » Mon Jun 18, 2007 3:30 pm

I use 2 USB drives, and 2 CF cards through a USB reader--any number of them at any given time. They get assigned to sda1, sdb1, sdc1, sdd1 at random (at least, it seems to me!) I would like each drive to always automount at the same mountpoint. I think this can be accomplished with UUID in fstab, but in that case...
How do I find out the UUID of a drive?
How can I explicitly use UUID for a removable drive in fstab and still have the drive mount automatically?

Or maybe there's another way to do this?

Thanks for your consideration!

Husse
Level 23
Level 23
Posts: 18701
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Post by Husse » Mon Jun 18, 2007 4:33 pm

You will loose the automount with this solution.....

This is the first occasion where I see a use for UUID :)
You're absolutely on track....
First find out the UUID

ls /dev/disk/by-uuid
or
sudo vol_id -u <partition>
where <partition> is your "dev" like sda1

See:
http://ubuntuforums.org/showthread.php?t=286758
http://www.ubuntuforums.org/showthread.php?&t=283131

For your drives I think you should find out their UUID - tools above :)
Then put them in fstab with noauto - like this
your_UUID_here /mnt/drive1 vfat rw,user,noauto,umask=0000 0 0

Then to mount
sudo mount /mnt/drive1
This should work - unless you get a permission problem, but that should be fixed with "user" in fstab
I can't check this out as I don't have a USB drive. If you know your way in Linux you will be able to fix the problems that may arise in recovery mode.
As for the CF cards I'm not sure - perhaps the same solution
Image
Don't fix it if it ain't broken, don't break it if you can't fix it

User avatar
Boo
Level 7
Level 7
Posts: 1634
Joined: Mon Mar 26, 2007 7:48 am

Post by Boo » Tue Jun 19, 2007 12:55 am

I use to do this same thing a few years ago on RH7.3 (and it is still used).

you have to turn off usb devices being auto mounted.
but when they are plugged in they are registered in /proc/... and they have a serial number.
so the script i wrote when run read the /proc/... got the serial number and then knew where to mount it from a statically defined list.
you also used the same script to unmount disks.

so i will now have to find said script.

:D
Image
Now where was i going? Oh yes, crazy!

Post Reply

Return to “Mounting Partitions”