Welcome! Log In Create A New Profile

Advanced

Best approach to automount usb drive?

Posted by rkrug 
Best approach to automount usb drive?
February 14, 2015 11:37AM
Hi

I want to automount external usb hdd and usb sticks on my pogoplug running Debian (Debian GNU/Linux 7 (wheezy)) using the following rules

- mount certain external USB drives (identified by UUID or label) to individuall specific folders read-only
- mount all other esternal USB drives into a directory /media/external/LABEL as *read-only*

Then share the folder /media/external/ using netatalk and samba so thet the hot-plugged devices are available for reading (no problem if I have the above)

My reasoning for read-only is
- the data on the hdd can not be modified accidently
- I can simply unplug the device as I am not writing to it (assuming that nobody is using the device anymore)

When I want to write to the device, I can always ssh into the pogoplug and mount it read-write (or specify an additional rule for a certain drive).

Any suggestions how I can achieve this with as little overhang as possible?

Thanks,

Rainer
Re: Best approach to automount usb drive?
February 14, 2015 12:00PM
rkrug,

- Simple approach: use usbmount (install the usbmount package).
- More complicated approach (and more flexible and powerful): use udev rules.

Also be aware that if you use a remote dekstop (xfce, lxde,...) then the automounting behavior is potentially different when you are in desktop.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 02/14/2015 12:03PM by bodhi.
Re: Best approach to automount usb drive?
February 14, 2015 01:28PM
Thanks. I will be using usbmount for the time being and use some shell-scripting magic to manage the mounting of special drives.

Thanks,

Rainer
Re: Best approach to automount usb drive?
February 18, 2015 09:24AM
I ended up using usbmount for all partitions to mount as read-only and adding the partitions I would like to have as read-write in the fstab - usbmount now automounts these as read-write to the specified mount point - perfect.

Thanks,

Rainer
Re: Best approach to automount usb drive?
February 21, 2015 05:57AM
@rkrug - thanks for posting, I always wondered how this was done !

Cheers

Don Charisma ... because anything is possible with Charisma

My blog - http://DonCharisma.org
Our commercial site - http://DonCharisma.com
Re: Best approach to automount usb drive?
February 21, 2015 12:27PM
With desktop, Check the automount with usbmount for correctness/conflicts.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: