Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2008 11:20:10 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Tim Daneliuk <tundra@tundraware.com>
Cc:        Helge Rohde <heroh@gmx.de>, freebsd-questions@freebsd.org
Subject:   Re: shellscript conditional to check for external disk
Message-ID:  <20080622092010.GB43950@slackbox.xs4all.nl>
In-Reply-To: <485D8969.1070704@tundraware.com>
References:  <200806212144.09925.heroh@gmx.de> <20080621224731.GA26997@slackbox.xs4all.nl> <485D8969.1070704@tundraware.com>

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

--pvezYHf7grwyp3Bc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jun 21, 2008 at 06:06:17PM -0500, Tim Daneliuk wrote:
> > 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.
> >=20
> > 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.
> >=20
> > Roland
>=20
> A variant of this approach that is filesystem independent would be
> to simply write an identifying zero-length file in the root of
> the removable backup drive:
>=20
> mount /mountpoint /dev/device
> cd /mountpoint && touch ThisIsABackupDrive
>
> Your backup script can just look for the presence of the file
> "ThisIsABackupDrive" whenever it is checking to see whether the drive
> is mounted.

The problem is that there can be several device nodes for USB disks,
each with up to four slices times six usable partitions. How
are you going to pick the right one? You'd have to try them all.
=20
> Since this is done at the filename level rather than in the disk
> metadata, your script doesn't care/have to change if the removable
> drive is formatted NTFS, FAT32, ufs, etc. I use such disks myself for
> the exact reason you do, but I keep them FAT32 because pretty much
> everything can read this filesystem. Of course, FAT32 cannot preserve
> the file naming and permissions semantics of ufs, so I just make by
> backups into a tarball and then copy the tarball to the removable
> drive.

Glabel(8) supports UFS, FAT12, FAT16, FAT32, ISO9660, ext2fs, reiserfs
and ntfs.

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)

--pvezYHf7grwyp3Bc
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkheGUoACgkQEnfvsMMhpyXaAgCcDdKXEKq/sb7/asOT4Te7en7B
wusAn2BLR4A2oMkRgVSWXxH9MiOr+UCF
=bpUF
-----END PGP SIGNATURE-----

--pvezYHf7grwyp3Bc--



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