On 29 September 2011 23:46, linux guy linuxguy123@gmail.com wrote:
Is there an easy was to know if a disk is mounted and act accordingly or prevent data from being written to a mountpoint ?
Here is how I prevent data accidentally being written to a unmounted mountpoint. You must first ensure that "/example/mountpoint" is an empty directory. Then
chattr -V +i /example/mountpoint
so for your example: chattr -V +i /home/me/myth
I started doing this for all my mountpoints after I read about the immutable bit. See:
man chattr
Re detecting if a disk is mounted, in older versions of fedora, the package sysvinit-tools provided the '\bin\mountpoint' command which implements this. Try:
man mountpoint
to see if it is available on your system.