auto mount external hard drive but only when present?
Duane Winner
dwinner-lists at att.net
Wed Mar 9 11:25:56 PST 2005
Hi all,
Hoping someone might have a good technique for this situation:
I have a laptop with a docking station and in the expansion bay of the
dock, I have a second hard drive, which I have configured as /dev/ad4s1d
and mount it to /hd2
Normally on workstations with a 2nd drive, I'll just put another line in
fstab and it will mount at each boot.
But because this is a laptop, and will be pulled off the dock when I'm
on the road, I can't have that, because FreeBSD will scream into single
user mode if that partition isn't there. I could put a 'noauto' switch
into fstab, but that still leaves me with the problem:
The reason for the second drive is for backups: I want to run rsnapshot
to take regular snapshots of my primary drive filesystems to the 2nd
drive, and rsnapshot runs as a cron job. Now rnsnapshot is smart enough
to know not to create the snapshot root if the mount isn't there, but
while I am docked, I'll have to remember to manually mount the second
drive. If I forget (which I'm apt to do), then no backups :(
What I'm looking for is a script or something that will mount
/dev/ad4s1d to /hd2 automatically when it's present, but ignore it when
it's not, and if possible to unmount it gracefully on shutdown.
I looked at amd automounting, but that seems to be a bit overkill (I
really don't like the idea of adding NFS et.al. if I can avoid it).
Any ideas?
Cheers,
DW
More information about the freebsd-questions
mailing list