# Duane Winner:
> 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
[...]
> 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:

Just a (rather crude) quickhack:

   #!/bin/sh

   SLEEP=300
   MOUNTED=0
   
   while [ 1 ]; do
       sleep $SLEEP

       if [ $MOUNTED = 0 ]; then 
           mount -t ufs2 /dev/ad4s1d /hd2 >/dev/null 2>&1

           if [ $? = "0" ]; then
               MOUNTED=1
           fi
       else
           touch /hd2/.touchme >/dev/null 2>&1

           if [ $? = "1" ]; then
               umount -f /hd2 >/dev/null 2>&1
               MOUNTED=0
           fi
       fi
   done

   
Basically, this'll try every $SLEEP seconds to either mount
the disk or, once this has been done successfully, to touch
a file on /hd2. If that fails, the disk's no longer there,
so force-unmount it.

I can't really test it, so I'm none too sure this works, though. :(

HTH,
Mario
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to