-1

Is there any way to check whether a directory has once been mounted? Thanks.

Jepsenwan
  • 170
  • 3
  • 12
  • 3
    Why do you want this info? – ewwhite Jun 10 '17 at 04:08
  • @ewwhite Coz I met a client who lost his data under /home directory. And he forgot whether he unconsciously mounted a disk on the directory earlier. I figured no way to confirm if he ever mounted any disk to this directory... – Jepsenwan Jun 10 '17 at 06:07

1 Answers1

2

No, you are not guaranteed to find traces of any type of mount. However, there are some usually-present indicators:

  • systemd will log its mounts, try zgrep -i mount /var/log/syslog*
  • most, but not all common filesystem drivers will spit out some diagnostics like EXT4-fs (sda14): mounted filesystem without journal.
  • mounting over a non-empty directory may result in a warning
  • external disks will have left syslog traces when attaching

You are probably more likely to find the directory in its real place. If its on the disk (-o bind) then there should be user-owned files in unusual places. If its an external disk, attaching/removing will have made the respective drivers spew out quite some informational wall of text.

anx
  • 8,963
  • 5
  • 24
  • 48