USB Automount Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Ziryab
Posts: 3
Joined: Mon Oct 01, 2018 5:16 pm

USB Automount

Post by Ziryab »

Hello there,

First I’m not sure if this functionality is available is DietPi as I’m fairly new to the Pi game.

I’m using Raspberry Pi 3 B+ and just moved from Raspbian to DietPi looking for one partical feature which I got the indication its available in DietPi (I hope I’m right)

I want to automount ANY usb without using the drive manager nor editing fstab anytime I plug in a new drive to my raspberry pi. When I used Raspbian it worked in desktop version but I want this in headless unit. I tried usbmount and pmount and non of them is straight forward nor work perfectly after spending hours setting them up. Using desktop version is not a choice for me as I want to save CPU and RAM power as much as possible.

So is there an easy way to just mount any plugged in usb or hdd similar to desktop systems?

Thanks in advance
User avatar
DrewG
Posts: 14
Joined: Mon Jan 09, 2017 3:58 am
Location: Alberta, Canada

Re: USB Automount

Post by DrewG »

The diet-pi drive manager would be your best bet AFAIK. That being said, there may be away to do it in linux but I'm not sure. Using the drive manager is pretty easy and quick to do.

Why are you wanting to connect / reconnect HDD's all the time? Unplugging the HDD without mounting it is probably no the best idea.

You may have to give more information as to what you are trying to accomplish in order to get more direction from the forums

- Drew
Ziryab
Posts: 3
Joined: Mon Oct 01, 2018 5:16 pm

Re: USB Automount

Post by Ziryab »

I think the Drive Manager requires manual setup and I have to choose each new drive manually to mount it as far as I know and I could be wrong.

What I'm trying to achieve is to setup a samba share for my parents (they don't know how to mount on unmount a drive). So my concept is automount any usb drive plugged in, and then use a drive pool software (MergerFS for example) and this pool will be shared via samba server. The usb sticks they use are not always the same usb sticks for stab entries won't be a good idea and it's not practical to manually add every new drive to fstab in this dynamic situation.

In summary, I want to automount ANY usb drive to specific directory with it's own mount point (maybe it's label or whatever), and the directory that will contain the mount points for all usbs will have it's stab entry using MergerFS to pool all of them, and the pool will be shared via samba.
User avatar
DrewG
Posts: 14
Joined: Mon Jan 09, 2017 3:58 am
Location: Alberta, Canada

Re: USB Automount

Post by DrewG »

Getting the Drive Manager setup is not too hard, but you're looking for away to mount / unmount once the drive is plugged in. Maybe if could be done with a button and some GPIO coding?

Push button --> button does the work behind the scenes to mount / unmount --> possibly play a sound or flash a LED when complete. All of that would require more coding & speaker or an LED(s) Not impossible but out of my league. Sounds like A LOT OF READING and googling. It's probably not impossible? But like I said it's out of my league

As for a label for the drive, any external drive that is getting mounted onto the DietPi now uses the UUID by default. I don't remember what it stands for but it's an ID that is specific to that hard drive / USB.

Best of luck, hopefully you'll be able to get it to work. Sorry I wasn't much help

- Drew
User avatar
WarHawk
Posts: 634
Joined: Thu Jul 20, 2017 8:55 am

Re: USB Automount

Post by WarHawk »

Code: Select all

#apt-get install automount autofs
Insert USB (it should mount it automatically to a directory)

Then type mount and it should list the new usb device as a mount location

just cd into that directory and it should work
Ziryab
Posts: 3
Joined: Mon Oct 01, 2018 5:16 pm

Re: USB Automount

Post by Ziryab »

@DrewG that would be to sophisticated to me as well and totally out of my league, I just started using terminals a month ago and have no clue about scripting! But thanks for the idea, it will be too cool to show off infront of my parents!

@WarHawk thanks I will give it a try as soon as I go home!
rosswesleyporter
Posts: 18
Joined: Tue May 24, 2016 6:57 am

Re: USB Automount

Post by rosswesleyporter »

@Zirya@Ziryab, did installing automount & autofs work for you?
petoniano
Posts: 1
Joined: Sat Jan 19, 2019 10:22 am

Re: USB Automount

Post by petoniano »

I have the same problem, with the programs above i receive: "Unable to locate package automount"

I need the automount feature because Iḿ going to have a backup server at my parent's home and when fot some reason they have a blackout , when the system is powered again I want it to keep working with the usb mounted.

Maybe my best choice is using fstab adding the hdd usb?

did you solved your problem finaly?
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: USB Automount

Post by MichaIng »

Just checked, and nowadays one should use the usbmount package: https://wiki.debian.org/usbmount

Code: Select all

apt install usbmount
Check the Debian wiki for two alternatives, if one wants to have desktop icons created, if a drive is attached.

EDIT: Ah lol no, usbmount is not available on Stretch and Buster: https://packages.debian.org/search?lang ... s=usbmount
I just got the above info from the autofs wiki: https://wiki.debian.org/AutoFs
But the info about autofs being superseded by usbmount seems to be again outdated :lol:.

Hmm then autofs should do, although it seems to require some manual configuration?

Further reading: automount is the command provided by the autofs package ;): https://manpages.debian.org/stretch/aut ... .8.en.html
rosswesleyporter
Posts: 18
Joined: Tue May 24, 2016 6:57 am

Re: USB Automount

Post by rosswesleyporter »

I eventually went with the pmount package and some udev rules. It's working well. Whichever USB drive I plug in is automatically available as /media/usb1. I documented the process here: https://github.com/rosswesleyporter/dqm ... ON_USB.pdf (look for the pmount & udev bits, you can ignore the music bits).
Post Reply