I have a small home server running Ubuntu 12.04 with an external hard drive attached to it. The external hard drive is mounted with autofs. Autofs basically unmounts a hard drive if it isn't used for a specified amount of time and automatically mount them back if some one tries to read / write from the mount folder.
Autofs and Samba working correctly my only problem now is:
- The samba shares are located within the external hard drive, I only want to share sub-folders. E.g.: the
musicfolder on the hard drive.
- Autofs mount the harddrive to
/automnt/external. If you access the folder the drive will be mounted and you can access the music folder (
- If the drive is unmounted and some one tries to access it samba apparently just tries to access the music sub-folder which is not yet accessible.
My question: Is it possible to tell samba before allowing access one of the shares to run a little script (
ls /automnt/extern would do) to make sure the drive is mounted?