From owner-freebsd-geom@FreeBSD.ORG Sun Jan 9 00:32:08 2011 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1B45106566C for ; Sun, 9 Jan 2011 00:32:08 +0000 (UTC) (envelope-from luchesar.iliev@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3C0618FC08 for ; Sun, 9 Jan 2011 00:32:07 +0000 (UTC) Received: by fxm16 with SMTP id 16so17950551fxm.13 for ; Sat, 08 Jan 2011 16:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id :disposition-notification-to:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:openpgp:content-type:content-transfer-encoding; bh=PkuglWSOsCBo9wDjOHQ1J6BhhMWhs1YW3bNirV6qIGo=; b=Z6VQJeuqddGgIb7hou/JfxIjtp/y4juYnIkDz2+wrrN14oEUrTSh5xShul9BjJy5r3 aEywExvzrZ7MmbezBydTiZysZXaCRQsWWxuuuiqKQDKKIoo1AcJYQ6zhoGhQRaTj0KZj X8f4qp8MdYMUTsqaCJHHN7h87pXSxkLY4YPus= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:disposition-notification-to:date:from:organization :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=BbLri4Kba/reJGjeCR8gfYCuFvQIsW3gglh/IEyQxupFDx6oeJGZkGzsmx6Lc+IglV b/nPWW+IPD6qR9AYJTmNhvkum3USV6r1g1QZaW9AOMmY6pbh95kAH3ETwGq87YOIvySF If5IgeVrYL6RR0fKtZLhnM5PdlatfPKKTSug8= Received: by 10.223.70.136 with SMTP id d8mr3849871faj.3.1294531352341; Sat, 08 Jan 2011 16:02:32 -0800 (PST) Received: from [79.124.93.41] ([79.124.93.41]) by mx.google.com with ESMTPS id c11sm6530773fav.26.2011.01.08.16.02.30 (version=SSLv3 cipher=RC4-MD5); Sat, 08 Jan 2011 16:02:31 -0800 (PST) Message-ID: <4D28FB15.9090907@gmail.com> Date: Sun, 09 Jan 2011 02:02:29 +0200 From: "Luchesar V. ILIEV" Organization: Ideaconsult Ltd. User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20101229 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: zeus@ibs.dn.ua References: <20110104170611.GA67159@relay.ibs.dn.ua> <4D28509D.607@yandex.ru> <20110108223747.GA66627@relay.ibs.dn.ua> In-Reply-To: <20110108223747.GA66627@relay.ibs.dn.ua> X-Enigmail-Version: 1.1.2 OpenPGP: id=9A1FEEFF; url=https://cert.acad.bg/pgp-keys/ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-geom@freebsd.org Subject: Re: "secondary GPT table is corrupt or invalid" issue again X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2011 00:32:08 -0000 On 01/09/2011 00:37, Zeus V Panchenko wrote: > Andrey V. Elsukov (bu7cher@yandex.ru) [11.01.08 13:55] wrote: >> >> FreeBSD 8.2 has implemented support of recovering GPT. You can try to >> boot from livefs image or just update your system and use >> 'gpart recover'. But i strongly suggest to read related paragraph >> in manual page before. Backup is recommended of course. >> > > what if i detach one hdd from mirror, than recover the one in mirror > and attach the first one again, will it be right way? > Hi Zeus, Just my two cents. If I understood correctly from your first mail, you've set up the gmirror on /dev/ada{1,2}p1; that is, you're not mirroring the whole disk, but just the (single) partition on it. gmirror(8) stores its metadata in the last sector of the provider, and since in your case that's the partition itself, I can't see how it could have overwritten the secondary GPT. I was wondering if your problem could be related to the ahci(4) driver? I think I've seen reports of problems with data integrity; considering that this infrastructure is not yet as mature as the old ata(4)-based one, this doesn't seem totally impossible with certain devices. Then again, I'd find it a bit strange to have only the secondary GPT get corrupt and nothing else if the problem had indeed been in the ahci driver... Speaking of that (and not related directly to your question), you might find it more convenient to use GPT partition labels in the future. For instance, in your example you could label the partitions... # gpart modify -i 1 -l teradisk0 ada1 # gpart modify -i 1 -l teradisk1 ada2 ...and then could create the mirror using the labels... # gmirror label -v -h -b load gm0 gpt/teradisk0 # gmirror insert -v -h -p 1 gm0 gpt/teradisk1 Using -h is important here, as otherwise gmirror will "forget" the labels. I'd like to draw your attention to the -p parameter as well. AFAIK it's not good to have the components with equal priority. Priority determines not only the preferred disk for the "prefer" algorithm, but, more importantly, the disk which is considered "master" when a resync is needed. This gets especially critical if you insert a blank component to a mirror which already holds data. gmirror might do the right thing, but probably not exactly for the right reasons. To summarize, I'd recommend that you always keep the disk you'd like to be "master" with priority "0" (which is considered highest) and all the rest in the mirror with lower (probably diminishing) priorities. Concerning the backup thing: what you described sounds reasonable to me, but with one very important thing to remember: the priorities again! If something goes wrong with the GPT recovery, be sure to set the priorities of the components the right way: the disk you consider healthy should be set with priority "0" and the other one with "1". You can change the priority of a component with e.g... # gmirror configure -v -p 1 gm0 ada1p1 ...and you've already noticed that you can set the priority of the inserted components as well. Of course, if you keep important data on that mirror, it might be still best to simply replicate it somewhere else, and take no risks. One last thing that you might consider: the sysutils/gdisk port. It's quite a capable program for maintaining GPT formatted disks, which could prove helpful in certain cases (e.g. with the protective MBRs). Good luck, and please let us know if you find what caused your problems. Cheers, Luchesar P.S. Please keep in mind that I might be wrong in some (or even all) of my assumptions and suggestions. I do have some experience with GPT and gmirror, but it's definitely far away from being extensive.