LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Mounting USB Drive to a user defined point (https://www.linuxquestions.org/questions/linux-software-2/mounting-usb-drive-to-a-user-defined-point-4175464094/)

hcgrant 05-30-2013 07:34 AM

Mounting USB Drive to a user defined point
 
I would like to be able to have my portable usb drive to be mounted to a defined location ... /RemStorage.

I put the following line into fstab ..
/dev/sde2 /RemStorage ext3 defaults 1 2

This works fine if I boot with the usb drive connected, if its not then everything goes pearshaped and the system goes into some repair ? mode

Without that line in fstab the drive gets mounted at /mnt/sde2 and will also automount as /mnt/sde2

I know this is a bit trivial but is there some way ..hotplug configuration maybe ... to make the system mount the usb drive to the point I want .../RemStorage ? And how does it get mounted to /mnt/sde2 anyway?
I could make /RemStorage a symlink to /mnt/sde2 I know but ;-)))

All thoughts gratefully received

Im using opensuse 12.2 64 bit

bigrigdriver 05-30-2013 10:00 AM

Hotplug events are controlled by udev rules. The rules are located somewhere like /etc/ude/udev.conf, or in /etc/udev/rules.d. Do some research in your Opensuse documentation on how to write udev rules that identify the device by uuid instead of /dev/sde6. The uuid is unique to the device, whether it be disk partition are removable device.

Once the udev rule is written to identify the device, you can then write the entry in /etc/fstab, using the same uuid instead of /dev/sde6, and your desired mount point.

I hope this helps.

Philip Lacroix 05-30-2013 11:08 AM

Do you have something on your device that the system needs and is looking for when booting? I ask, because this might explain why things are going wrong when the disk is not there.

Anyway, in order to have your device unequivocally identified by the system you should put its UUID in fstab, instead of /dev/sde2. You can see such identifier using the blkid command. Like:

Code:

#~ blkid /dev/sde2
You'll get something like this:

Code:

/dev/sde2: UUID="<some-ID>" TYPE="ext3"
Put UUID=<some-ID> (without quotes) in /etc/fstab, where /dev/sde2 is now. The system will recognize the device unambiguously and will not mount anything else on that mount point, unless it is specified elswhere.

Best regards,
Philip

hcgrant 05-30-2013 06:05 PM

Thanks for the replies Philip and bigrigdriver.

Ill have a look at the udev documentation.

I used blkid and started to create a fstab entry.
But then I saw there was already an entry in my fstab to mount a device to /mnt/sde2! lol! Not put there by me!
What is interesting though is that there was also a flag "nofail" in place of "defaults" for that entry. So I think that flag is preventing the absence of the usb drive causing a boot failure.
Ive now changed that entry to mount to /RemStorage and all is well! :-)

Thanks again for your replies.


All times are GMT -5. The time now is 07:51 PM.