From owner-freebsd-questions@FreeBSD.ORG Sat Jun 21 22:47:34 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 127701065673 for ; Sat, 21 Jun 2008 22:47:34 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr13.xs4all.nl (smtp-vbr13.xs4all.nl [194.109.24.33]) by mx1.freebsd.org (Postfix) with ESMTP id 907B38FC18 for ; Sat, 21 Jun 2008 22:47:33 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id m5LMlVIa017319; Sun, 22 Jun 2008 00:47:32 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id BD481BA9D; Sun, 22 Jun 2008 00:47:31 +0200 (CEST) Date: Sun, 22 Jun 2008 00:47:31 +0200 From: Roland Smith To: Helge Rohde Message-ID: <20080621224731.GA26997@slackbox.xs4all.nl> References: <200806212144.09925.heroh@gmx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <200806212144.09925.heroh@gmx.de> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions@freebsd.org Subject: Re: shellscript conditional to check for external disk X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jun 2008 22:47:34 -0000 --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 21, 2008 at 09:44:09PM +0000, Helge Rohde wrote: > Hello List, >=20 > I need to write a backup script, and one of the required actions would be= a=20 > copy of the backup to an external firewire drive. I would like to make th= is=20 > as easy as possible for the local staff, so i'd like to check whether the= =20 > drive is attached, if necessary mount it, copy over the backup and unmou= nt=20 > it again, so that the local staff can swap the external disks when they'r= e=20 > not used. > =20 > Is there a canonical way to achieve what i want? I played with the idea o= f=20 > simply checking for /dev/da0s1d's existance, but that won't disappear on= =20 > disconnect, so that would leave the is a possibility that although da0 i= s=20 > in /dev, it might not be connected. Use glabel(8) to give the device an unique label. There is no telling which device /dev/da0s1d is pointing to! After labeling you can check for /dev//, which should be unique. Make sure to unmount the drive at the end of the backup script, or you'll get a kernel panic when staff pulls the plug on a mounted device. Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --huq684BweRXVnRxX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkhdhQMACgkQEnfvsMMhpyVQ7QCgo2rrCYepru3CYR+WssW+++xo 1MwAoJiRfroJM7jGccCaiTipuiMmI6s6 =0Yff -----END PGP SIGNATURE----- --huq684BweRXVnRxX--