[TUTORIAL] USB Automount

fireon

Famous Member
Oct 25, 2010
3,808
303
103
39
Austria/Graz
iteas.at
Hello all :)

I may I present the brand new usb automount. It is designed to mount multible usbsticks on the fly with ext, fat and NTFS filesystems (they are tested) by creating a temporary usbstorage at pve. The stick will be mount as sync, so unmounting is not necessary. Startet with PVE5.1, old repository.

You can install the package by using us own repository. After that:
Code:
apt update
apt install pve7-usb-automount

At this point I would like to thank @The_Invisible for the work done in his free time.
Very thanks for the great package!
 
Last edited:
  • Like
Reactions: vizsla

ESC-Phil

New Member
Mar 6, 2018
2
0
1
33
Hello fireon

i tried your package but it wants to install just a bit more as i want...



root@pve:~# apt install pve5-usb-automount
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
adwaita-icon-theme aspell aspell-en at-spi2-core dconf-gsettings-backend dconf-service dictionaries-common emacsen-common enchant
exfat-fuse exfat-utils glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-x gtk-update-icon-cache hicolor-icon-theme hunspell-en-us iso-codes
libaa1 libaspell15 libatasmart4 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libavc1394-0 libcairo-gobject2
libcdparanoia0 libcolord2 libcroco3 libdconf1 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libdv4 libegl1-mesa
libenchant1c2a libepoxy0 libgbm1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa
libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libharfbuzz-icu0
libhunspell-1.4-0 libhyphen0 libiec61883-0 libjack-jackd2-0 libjavascriptcoregtk-4.0-18 libjbig0 libjson-glib-1.0-0
libjson-glib-1.0-common liblcms2-2 libllvm3.9 libnotify4 libopus0 liborc-0.4-0 libparted2 libpciaccess0 libpolkit-agent-1-0
libpolkit-backend-1-0 libpolkit-gobject-1-0 libproxy1v5 libraw1394-11 librest-0.7-0 librsvg2-2 librsvg2-common libsamplerate0
libsecret-1-0 libsecret-common libsensors4 libshout3 libsoup-gnome2.4-1 libsoup2.4-1 libspeex1 libtag1v5 libtag1v5-vanilla libtheora0
libtiff5 libtxc-dxtn-s2tc libudisks2-0 libv4l-0 libv4lconvert0 libvisual-0.4-0 libvpx4 libwavpack1 libwayland-client0
libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libwebkit2gtk-4.0-37 libwebp6 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxinerama1 libxkbcommon0 libxrandr2
libxshmfence1 libxv1 libxxf86vm1 notification-daemon parted pmount policykit-1 shared-mime-info udevil udisks2 zenity zenity-common
Suggested packages:
aspell-doc spellutils gvfs hunspell openoffice.org-hunspell | openoffice.org-core isoquery colord libdv-bin oss-compat
libenchant-voikko libvisual-0.4-plugins gstreamer1.0-tools jackd2 liblcms2-utils opus-tools libparted-dev libparted-i18n
libraw1394-doc librsvg2-bin lm-sensors speex libwebkit2gtk-4.0-37-gtk2 parted-doc cryptsetup curlftpfs sshfs cryptsetup-bin mdadm
reiserfsprogs
The following NEW packages will be installed:
adwaita-icon-theme aspell aspell-en at-spi2-core dconf-gsettings-backend dconf-service dictionaries-common emacsen-common enchant
exfat-fuse exfat-utils glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-x gtk-update-icon-cache hicolor-icon-theme hunspell-en-us iso-codes
libaa1 libaspell15 libatasmart4 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libavc1394-0 libcairo-gobject2
libcdparanoia0 libcolord2 libcroco3 libdconf1 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libdv4 libegl1-mesa
libenchant1c2a libepoxy0 libgbm1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa
libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libharfbuzz-icu0
libhunspell-1.4-0 libhyphen0 libiec61883-0 libjack-jackd2-0 libjavascriptcoregtk-4.0-18 libjbig0 libjson-glib-1.0-0
libjson-glib-1.0-common liblcms2-2 libllvm3.9 libnotify4 libopus0 liborc-0.4-0 libparted2 libpciaccess0 libpolkit-agent-1-0
libpolkit-backend-1-0 libpolkit-gobject-1-0 libproxy1v5 libraw1394-11 librest-0.7-0 librsvg2-2 librsvg2-common libsamplerate0
libsecret-1-0 libsecret-common libsensors4 libshout3 libsoup-gnome2.4-1 libsoup2.4-1 libspeex1 libtag1v5 libtag1v5-vanilla libtheora0
libtiff5 libtxc-dxtn-s2tc libudisks2-0 libv4l-0 libv4lconvert0 libvisual-0.4-0 libvpx4 libwavpack1 libwayland-client0
libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libwebkit2gtk-4.0-37 libwebp6 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxinerama1 libxkbcommon0 libxrandr2
libxshmfence1 libxv1 libxxf86vm1 notification-daemon parted pmount policykit-1 pve5-usb-automount shared-mime-info udevil udisks2
zenity zenity-common
0 upgraded, 131 newly installed, 0 to remove and 41 not upgraded.
Need to get 74.7 MB of archives.
After this operation, 378 MB of additional disk space will be used.
Do you want to continue? [Y/n]


Is this a known bug or a feature?
 

ESC-Phil

New Member
Mar 6, 2018
2
0
1
33
So with that much deoendencies i dont think thats a good option for the automount problem.

I want my host to be slim and light.

Isnt there a way to dont need that much deps?
 

reetp

Active Member
Aug 19, 2013
49
3
28
Hello all :)

I may I present the brand new usb automount. It is designed to mount multiple usbsticks on the fly with ext, fat and NTFS filesystems (they are tested) by creating a temporary usbstorage at pve. The stick will be mount as sync, so unmounting is not necessary. Tested on PVE5.1

Can I make a suggestion for an improvement?

Each drive gets mounted to its own mount point based on the drive label.

So we get:

sdc1-usb-BackupDrive_1
sdc1-usb-BackupDrive_2

Is it possible to override this behaviour and always mount at the same point regardless of the label ?

Yes, I can relabel each drive to the same name so it gets mounted at the same mountpoint, but I'd prefer to leave them as they are eg Backup_1 Backup_2 etc so I know which they are.....

I have some users who change a backup drive daily, but it's tricky with setting up the automatic backup when the mount point keeps changing.

I did look at the file involved

rc.local

--exec-on-drive '/usr/local/bin/mount_drive.py "%f" "%d"' \

Could be changed to this (or read from a config file?)

--exec-on-drive '/usr/local/bin/mount_drive.py "%f" "/media/Backup"' \

However I struggle with this

pvesm add dir 'usb-%s' -path '%s' -maxfiles 0 -content vztmpl,iso,backup" % (devname, mountpoint)

I can see this picks up %s as the partition eg sdc1 so you add a dir usb-sdc1 but don't get how it then creates:

/media/sdc1-usb-BackupDrive_1

Any suggestions??
 

reetp

Active Member
Aug 19, 2013
49
3
28
Hmmm - just noticed now I have usb-sdc1 as a drive in the manager. I never had that before ! That is clearly added by the pvesm add command.

You can see the auto added usb-sdc1 and the added manually 'Directory' USB-Backup (/media/Backup)

I have also noticed that if I leave it set as automount the backup transfer speeds have become extremely slow - almost Kb/s

/dev/sdc1 on /media/Backup type fuseblk (rw,nosuid,nodev,noexec,noatime,sync,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)

If I dismount and then remount manually the transfer speeds are significantly faster and as expected:

/dev/sdc1 on /media/Backup type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

Really doesn't make any sense.

Any assistance appreciated.
 

Attachments

  • USB-Drive.png
    USB-Drive.png
    5.7 KB · Views: 54

fireon

Famous Member
Oct 25, 2010
3,808
303
103
39
Austria/Graz
iteas.at
  • Like
Reactions: PlOrAdmin

JeremySeel

New Member
Feb 24, 2020
2
0
1
21
Hey I'm new to ProxMox and Linux in general.
Can anyone please explain what i have to do in order to install the USB automount?
I do not know how to add or install from the repository given above.
I want to install a SUSE Linux (SLES 12) VM on my ProxMox.

Thank you very much
 

tburger

Active Member
Oct 13, 2017
778
91
33
38
@JeremySeel According to my understanding this utility is being used on the Proxmox host, not within VMs.
You would need to add an repository in /etc/apt/sources.list.d on the Proxmox server, using the information provided in the link of the first post.
Then do an "apt update" and "apt install" as outlined in the first post
 

fireon

Famous Member
Oct 25, 2010
3,808
303
103
39
Austria/Graz
iteas.at
Update for PVE6.x:

New package now for PVE6 available:
Code:
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2FAB19E7CCB7F415
echo "deb https://apt.iteas.at/iteas buster main" > /etc/apt/sources.list.d/iteas.list
apt install pve6-usb-automount

Now the many libs are no longer needed.
 

briancis

New Member
Apr 22, 2020
2
1
1
48
At this time, I get "E: Unable to locate package pve6-usb-automount" when executing these instructions under 6.2-4.
 

briancis

New Member
Apr 22, 2020
2
1
1
48
Thanks for the quick response. Yes you are correct...my dumb mistake. As an aside, and let me know if I should open as a separate topic, but I had originally used the GUI to add a backup storage on a USB drive. That drive is automounting upon installation of the automount package above and after reboot, but the storage now has a ? and an attempt to view the content results in:

unable to activate storage 'backups2' - directory is expected to be a mount point but is not mounted: '/mnt/pve/backups2' (500)
 
  • Like
Reactions: vizsla

vizsla

Member
Aug 27, 2017
23
1
8
Upper Midwest
As an aside, and let me know if I should open as a separate topic, but I had originally used the GUI to add a backup storage on a USB drive. That drive is automounting upon installation of the automount package above and after reboot, but the storage now has a ? and an attempt to view the content results in:

unable to activate storage 'backups2' - directory is expected to be a mount point but is not mounted: '/mnt/pve/backups2' (500)
I'm seeing this too.
 

sebcbien

Member
Jun 7, 2020
37
3
8
50
Hello,
USB Automount works quite perfectly for me to mount USD Drives, thanks a lot.
Where I have a problem is when I try to unmount.
First I do a
umount /media/sde1

The drive sde1 still shows in the tree of a lsblk but not mounted:
lsblk ... sdd 8:48 0 465.8G 0 disk └─sdd1 8:49 0 465.8G 0 part /media/sdd1 sde 8:64 0 7.3T 0 disk └─sde1 8:65 0 7.3T 0 part

However in the gui, at pve/disks, it still shows as /dev/sde - hardrive - mounted

And also appears in the left menu, below pve, as a storage: Storage-icon 'usb-sde1 (pve)
on the right, this is displayed:
- Title of the display: Storage 'usb-sde1' on node 'pve
- Content:unable to activate storage 'usb-sde1' - directory is expected to be a mount point but is not mounted: '/media/sde1' (500)
How can I unmount correctly, as it seems doing an umount makes proxmox not happy.
Thank a lot !
 

sebcbien

Member
Jun 7, 2020
37
3
8
50
Help ... no one knows how to unmount a usb disk on Proxmox ??? ;)
I have my usb storage with a question mark in the tree under pve.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!