From owner-freebsd-questions@FreeBSD.ORG Tue Oct 13 13:02:26 2009 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 BE11B106566B for ; Tue, 13 Oct 2009 13:02:26 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 37DA98FC19 for ; Tue, 13 Oct 2009 13:02:26 +0000 (UTC) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n9DD2JUk097893; Tue, 13 Oct 2009 14:02:20 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk n9DD2JUk097893 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1255438940; bh=Wbo7MciO9rRvRxoqOLdUoZ3nD1Q4Ya1A/zzBzZ/igJI=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4AD47A55.2060707@infracaninophile.co.uk>|Date:=20T ue,=2013=20Oct=202009=2014:02:13=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.23=20(X11/20090823)|MIME-Vers ion:=201.0|To:=20Nick=20Barnes=20|CC:=20freebsd -questions@freebsd.org,=20=0D=0A=20Ravenbrook=20SysAdmins=20|Subject:=20Re:=20how=20does=20gmirror=20start =20up?|References:=20<59889.1255436565@thrush.ravenbrook.com>|In-R eply-To:=20<59889.1255436565@thrush.ravenbrook.com>|X-Enigmail-Ver sion:=200.95.6|Content-Type:=20multipart/signed=3B=20micalg=3Dpgp- sha256=3B=0D=0A=20protocol=3D"application/pgp-signature"=3B=0D=0A= 20boundary=3D"------------enigF0F0AB4AE5452F29D70E2002"; b=s2xfMhr+HMZ6z9jAAO9+k+U7d9Fx3DR6Hx2Z4CbEzI/16LMSfW2gk0e0pUSw8Nb/8 +cSQZ4Fl2AeWuXyydxWfkItTRyDOCJr8hkT8nYFd2GlO922kZURfYuz1l+HXTd9D+X OQPJSjU9IJOYalLbL/fi6V54Aos1NRj/w+JsOl3M= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4AD47A55.2060707@infracaninophile.co.uk> Date: Tue, 13 Oct 2009 14:02:13 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: Nick Barnes References: <59889.1255436565@thrush.ravenbrook.com> In-Reply-To: <59889.1255436565@thrush.ravenbrook.com> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigF0F0AB4AE5452F29D70E2002" X-Virus-Scanned: clamav-milter 0.95.2 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org, Ravenbrook SysAdmins Subject: Re: how does gmirror start up? 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: Tue, 13 Oct 2009 13:02:26 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF0F0AB4AE5452F29D70E2002 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Nick Barnes wrote: > I am running a 6.3 system and have had various problems with disk > reliability on a key filesystem, probably down to SCSI hardware or > drivers. I'm intending to replace that SCSI disk with a pair of SATA > disks ad6/7, using gmirror as gm0 (while keeping ad4 as our boot > disk). I have set up the mirror and right now I'm part-way through > using rsync to transfer the data. But I have a question concerning > the underlying operation of GEOM, which is troubling me. I have read > the various man pages and handbook pages relating to GEOM and gmirror, > but they don't seem to answer this. >=20 > When I reboot the system, gmirror comes up (because of the line in > /boot/loader.conf) and gm0 appears, backed by ad6/7. Where is this > configuration information stored? That is, how does the system know > to make gm0, with ad6/7 as the backing store. >=20 > I would expect there to be a file somewhere in /etc with this config > information, but I don't see it in the documentation. From reading > gmirror(8), I understand that there is a label sector at the ends of > ad6 and ad7, identifying them as parts of gm0. But that config > information is back-to-front: at boot time the system knows from > /etc/fstab that it needs gm0; how does it find the underlying disks? >=20 > Does the system search the ends of all physically-attached disks, > looking for GEOM labels, and automatically make any corresponding GEOM > devices? Surely not (that would mean, for instance, that if I took > one of these disks out of this machine and put it into another FreeBSD > system then that machine would automatically set up gm0 with this > disk). >=20 > Possibly I'm just being dense. Can someone enlighten me? The geom configuration is stored on the disks in question -- I believe it= uses the last cylinder of the drive, but I could be wrong about the detai= ls. On startup, if the appropriate geom modules are loaded into the kernel, geom will "taste" the disks discovered by enumerating the contents of all= =20 ATA, SCSI, USB, etc. busses (ie. read any geom metadata) to see if they a= re part of a RAID array of some type. The RAID will be automatically recrea= ted, and appears to the system as a new device. If there are appropriate entr= ies in /etc/fstab any file systems on it will be mounted. There's no data stored on the filesystem describing the RAID setup. Well= , unless you make a backup of it yourself by dumping the output of 'gmirror= status' somewhere. This means that you can move the disks from one server to another and all= the RAIDs will survive. Actually, it's good enough that it can cope with you= shuffling the disks or installing them with completely different underlyi= ng device names. You would certainly have to avoid a clash of geom device n= ames when doing that -- the names are entirely arbitrary and 'gm0' is only the= de-facto=20 default because it was used in one of the most popular tutorials on the s= ubject.=20 If you think it necessary, you could include the host name in the geom la= bel or otherwise take action to make them globally unique across all your= systems. You can achieve a similar effect for plain disks by using glabel -- this = is a handy way of avoiding the foot-shooting potential of a USB thumb drive th= at maps as da0 on reboot, in place of the real system disk. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigF0F0AB4AE5452F29D70E2002 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkrUelsACgkQ8Mjk52CukIxCNACfSCHzt3binQDZ+IkyKqlgix5/ ElAAnAiwfPuLfpkuOF0OkNRB1uXS8Xgz =eUn0 -----END PGP SIGNATURE----- --------------enigF0F0AB4AE5452F29D70E2002--