I'm seeing apparently conflicting information on the proper way to auto-mount USB flash drives at boot. Most instructions on how to do it say to use an entry in fstab. Gnome Disks has a built-in feature to automate this entry. It seems to recognize a flash drive as a flash drive and know how to properly make an entry for it in fstab, and the entry works.
On the other hand, I've read that pluggable drives should be handled by uDev rather than fstab, including essentially permanently plugged devices. Consistent with this, Disk Manager (a utility bundled with MX Linux), opens on my system (containing a working fstab entry for a flash drive), with an error message:
I cannot find any existing block devices corresponding to the following devices:
/dev/disk/by-id/usb-Samsung_Flash_Drive_<id> on <mount point>
It is advisable to remove them to avoid failed mount at start-up.
Once that message is bypassed, Disk Manager excludes the (properly mounted) drive from its display. It has an issue with the fact that it isn't a block device, let alone pluggable.
What I assume is a backup for fstab made by Disk Manager at some point, /etc/fstab-disk-manager-save
, begins with the comment:
# Pluggable devices are handled by uDev, they are not in fstab.
An observation: auto-mounting a flash drive is a commonplace requirement. As such, one would expect there to be tools to assist in setting this up. The existing tools all seem to do it by creating an entry in fstab. Using uDev appears to require writing your own custom program, and there are many questions on Stack Exchange from programmers needing help with this (so it doesn't appear to be a method for novice users).
There's the old saying, "If it ain't broke, don't fix it", and the fstab entry method appears to work. OTOH, the advice about using uDev and the warning about mount failure means there are some conditions in which fstab won't work for this, which suggests that fstab is the wrong tool for the job and shouldn't be relied on just because it works in some cases.
So should a "permanently" plugged-in flash drive be mounted via fstab or uDev, and what is the risk suggested by the Disk Manager warning?
/etc/fstab
is a good place.