0

Here is an /etc/fstab record example of one of the mounts as per x-systemd.automount and other goodies:

UUID=XXXX-XXXX /media/XXXX-XXXX auto noauto,nofail,nouser,uid=root,gid=users,umask=007,X-mount.mkdir,x-systemd.automount,x-systemd.device-timeout=1,x-systemd.idle-timeout=60 0 2

Currently this external exFAT-formatted drive is physically disconnected from the PC, but I still get the following surprises

$ ls /media
ls: cannot access '/media/XXXX-XXXX': No such device

and

$ findmnt /media/XXXX-XXXX
TARGET           SOURCE    FSTYPE OPTIONS
/media/XXXX-XXXX systemd-1 autofs rw,relatime,fd=55,pgrp=1,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=24590

This obviously fools other software, which might potentially be using findmnt to determine whether the mount is up, to believe that the storage drive is actually mounted and to proceed with further actions.

How do I make sure that when the drive is physically disconnected, it is no longer considered by the Linux system?

  • seems to me tgat media is still mounted? – djdomi Oct 16 '21 at 15:59
  • @djdomi, it's not, the record you see just reflects `fstab` and `systemd` relation. There is no actual mount in either `mount`, `df`, `lsblk`, etc. – Alexander Shukaev Oct 16 '21 at 20:39
  • did you tried `eject` or `udisks --detach /dev/sdX` or `udisksctl power-off -b /dev/sdb`in reference to [this post](https://unix.stackexchange.com/questions/35508/eject-usb-drives-eject-command/129282) – djdomi Oct 17 '21 at 09:51
  • @djdomi, the problem with this is that there is no device to begin with. The device is gone and that's exactly what `ls` complains about for instance. `lsblk` also does not provide any insight. Of course I remember what was the name of the device and I tried to enter it manually in `eject` command, what naturally results in `eject: /dev/sdd: not found mountpoint or device with the given name` error message. – Alexander Shukaev Oct 17 '21 at 10:08
  • UUID=XXXX-XXXX /media/XXXX-XXXX is the X anomized? – djdomi Oct 17 '21 at 12:10
  • @djdomi, yup, in reality letters are different, but that's irrelevant here. – Alexander Shukaev Oct 17 '21 at 19:48
  • why do you do this? is that a secret? – djdomi Oct 18 '21 at 04:00

0 Answers0