Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964799AbcJRKHh (ORCPT ); Tue, 18 Oct 2016 06:07:37 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:54578 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933942AbcJRKH3 (ORCPT ); Tue, 18 Oct 2016 06:07:29 -0400 Subject: Re: [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk To: Karel Zak , Hannes Reinecke References: <1476699630-127009-1-git-send-email-hare@suse.de> <20161018095637.tgdjehscttskqz5q@ws.net.home> Cc: Davidlohr Bueso , Jens@suse.de, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org From: Hannes Reinecke Message-ID: Date: Tue, 18 Oct 2016 12:07:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161018095637.tgdjehscttskqz5q@ws.net.home> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2239 Lines: 60 On 10/18/2016 11:56 AM, Karel Zak wrote: > On Mon, Oct 17, 2016 at 12:20:30PM +0200, Hannes Reinecke wrote: >> The GPT specification requires that the alternate GPT is at the >> end of the disk. However, if a Software RAID1 is enabled the RAID >> metadata typically placed at the end of the disk, and the actual >> size of the disk is decreased by the size of the metadata. > > This is not about GPT, but about kernel. It does not support this > use-case and it parses PT on wrong device. If I good remember udev > should be smart enough to remove (by partx) such partitions and > re-create on /dev/mdX. > And introducing a nice race condition when doing so. Yes, I've noticed :-( > The real solution is to use RAID1 signatures on the begin of the disk. > This problem is generic, not specific to GPT. > I would if I had a choice. To quote SNIA DDF: 'The Anchor Header for the DDF structure MUST be stored on the last logical block returned by either the ATA Identify Device or SCSI Read Capacity commands depending on the type of physical disk.' Emphasis is from the document. >> Plus it's perfectly legit to have a partition table which is >> _smaller_ than the device > > Well, this is reason why GPT differentiate between headers position > and usable area (addressed by {First,Last}UsableLba within the header. > >> eg we don't check for the device >> size in the msdos partition, neither. > > All the "backup" GPT stuff is based on well known place for the backup > header. How do you want to reliably support GPT recovery from the > backup header if there is no explicit place for the header? > > Let's imagine your primary header is broken and alternate_lba is > unreliable (or zero, etc.), where is the backup header? > Sure, if things are broken we have to back off. But if things are not broken (as is the case here), and the GPT is just formatted for a smaller disk, why do we care? Or, to put it the other way round: Why do we care for GPT but not for msdos? Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.com +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: F. Imend?rffer, J. Smithard, D. Upmanyu, G. Norton HRB 21284 (AG N?rnberg)