On Sun 30 Dec 2018 at 21:47:37 -0800, David Christensen wrote:
> On 12/30/18 7:09 PM, Jorin Gedamke wrote:
> > Hello. I want to use a USB stick, but it never appears in fstab. Nor can I
> > use genfstab; it's not installed. Please, can someone tell me which package
> > contains genfstab, or how to search apt for it?
> /etc/fstab is a file that the system administrator (you) is expected to
> maintain. But, you don't need an fstab(5) entry to access a USB stick.
Correct - a user can use utilities like pmount, udevil or udisksctl
to mount a partition on a USB stick. For a variety of sticks used
this is probably a good approach (in conjunction with lsblk).
> If you are using a graphical desktop, the USB stick should be
> "automagically" mounted when inserted. Be sure to right-click and "eject"
> the USB stick before removing it.
This type of automounting would be closely associated with default
installations of DEs such as GNOME, Xfce, Mate etc. A fvwm user would
have to make an effort to get it.
[Good advice snipped]
Sticking with the desire for an fstab entry, we could could automount
and autounmount using systemd:
Use 'lsblk -f' to get the UUID of a partition on the stick. In fstab:
UUID= /media/usbstick auto defaults, noauto,x-systemd.automount,
x-systemd.idle-timeout=5,x-systemd.device-timeout=1 0 0
(All on one line)
* x-systemd.automount mounts /media/usbstick when any command (such
as ls) wants to use it.
* systemd.idle-timeout leads to unmounting the partition a specified
time period after the calling program ceases to access it.
* noauto causes /media/usbstick not to be mounted while the machine is
* x-systemd.device-timeout configures how long systemd should wait when
no device is plugged in or an incorrect device is found.