[TUTORIAL] USB Automount

fireon

Well-Known Member
Oct 25, 2010
3,028
187
63
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. Tested on PVE5.1

You can install the package by using us own repository. After that:
Code:
apt update
apt install pve5-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
31
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
31
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

Member
Aug 19, 2013
45
2
8
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

Member
Aug 19, 2013
45
2
8
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

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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!