Inhaltsverzeichnis

Linux USB-Mount

Recently I noticed the problem, that I could write only with speeds of about 500kByte/s onto USB flash drives. 20MBytes/s should be normally possible.

My observeations so far:

Errors on already mounted

The error message came from my file manager nemo, and it could be removed by disabling the automount feature of nemo, since usbmount keeps track of this task.

nemo -> menu -> edit -> preferences -> behavior -> media handling -> uncheck "Automatically mount removable media when inserted and on startup"

My system mounts a plugged in USB drive automatically on /media/usb0, or with the suffix 1,2,3. These directories exist on my system permanently. When I plug the drive in the first time after boot, it will be mounted to usb0, after remounting it 3 times, it will be mounted in usb3. On the next replug, it will be mounted e.g. on /media/karl/E2A3-F90D. All the /media/usb* dirs cannot be deleted:

sudo rm -R /media/usb0
rm: cannot remove 'usb0': Device or resource busy

a

sudo umount /media/usb0

is needed before that folder can be removed.

Removed usbmount --> using pmount

usbmount is a script installed on my system and it seems to be run by the udev-rule in /lib/udev/rules.d/90-usbmount.rules. It's config is in /etc/usbmount/usbmount.conf:

usbmount.conf

mount

Calling mount on a terminal shows these last lines:

/dev/sdc on /media/usb0 type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdd on /media/usb1 type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sde on /media/usb2 type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdf on /media/usb3 type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdh on /media/karl/E2A3-F90D type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

The mount options are quite different.

The option nosuid is missing for usb0…usb3, which prevents the normal user to unmount it.

I've uninstalled usbmount without any obvious problems so far.

According to 1) pmount is used instead, which is installed on my Linux Mint 19.1 handles the automatic mounting of USB drives, which results e.g. to such a line in the output of mount:

/dev/sdc on /media/karl/E2A3-F90D type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

Nemo's reported writing speed

Normally it showed a reasonable writing speed. But recently this changed to very high speeds, and then hanging at 98 or 100%.

Calling sync in the terminal synchronizes all block devices (as far as I understand). Calling it with time sync reports the time sync needed to finish it's job.

Flash drives should not be mounted with the mount-option sync, since this could cause such issues.

Running

sudo sysctl vm.dirty_bytes=15000000

as suggested here 2), which is described more in detail here 3) didn't help.

This problem remains unsolved.

Useful Commands

mount
sudo umount /media/usb0
time sync
sync
dmesg
lsusb -t