I have a file server set up to share an external drive over samba and netatalk (AFP). I have an fstab entry to automatically mount the drive at /mnt/external
, which then gets shared automatically by the various daemons.
The problem is if the drive doesn't mount properly (e.g. if I forgot to turn it on, or if I took it to work that day). In this case the mountpoint gets shared without the corresponding drive attached, resulting in various meta files getting written to my mount point rather than a clean failure. This prevents the drive from mounting properly the next time I attach it (non-empty directory), and could lead to data loss if someone used the share in the mean time.
Is there any way to cause the shares to fail in the case that the drive is unmounted?
/etc/rc.local
(and by hand afterward) so that I can create the directory on mount and remove it on umount. That should lead to a clean failure of the sharing daemons...