Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2008 00:47:31 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Helge Rohde <heroh@gmx.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: shellscript conditional to check for external disk
Message-ID:  <20080621224731.GA26997@slackbox.xs4all.nl>
In-Reply-To: <200806212144.09925.heroh@gmx.de>
References:  <200806212144.09925.heroh@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help

--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/<fstype>/<yourlabel>, 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080621224731.GA26997>