From owner-freebsd-questions@FreeBSD.ORG Wed Mar 9 19:25:55 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDF1B16A4CE for ; Wed, 9 Mar 2005 19:25:55 +0000 (GMT) Received: from mtiwmhc11.worldnet.att.net (mtiwmhc11.worldnet.att.net [204.127.131.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1AC6343D49 for ; Wed, 9 Mar 2005 19:25:49 +0000 (GMT) (envelope-from dwinner-lists@worldnet.att.net) Received: from [10.10.100.96] (unknown[216.113.237.29]) by worldnet.att.net (mtiwmhc11) with ESMTP id <20050309192546111004aouhe>; Wed, 9 Mar 2005 19:25:46 +0000 Message-ID: <422F4DB5.1040900@att.net> Date: Wed, 09 Mar 2005 14:25:41 -0500 From: Duane Winner User-Agent: Mozilla Thunderbird 1.0 (X11/20050303) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: auto mount external hard drive but only when present? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2005 19:25:56 -0000 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