I have a backup system that uses mounts that are put in place in fstab. I had a failure today because the mount was not there. I want to have my script check for the mount, then mount if it is not present.
i.e.
if mountpoint -q /mnt/mountpoint; then
echo "`date` /mnt/mountpoint is a mountpoint"
else
mount /mnt/mountpoint
fi
Given the above, will mount
use the settings that are in fstab, or do I need to specify them in my script?
Yes,
mount
with one argument (which can be either a directory or a device) uses settings from/etc/fstab
(at least it is so on Linux).Alternatively, you can ignore
/etc/fstab
settings and specify both device and mount point explicitly:mount /dev/sda1 /mnt/mountpoint
.