Util-Linux package development
 help / color / mirror / Atom feed
From: Peter Cordes <peter@cordes.ca>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: sfdisk problem with a partition starting early on a GPT disk
Date: Mon, 02 Mar 2015 18:31:10 -0400	[thread overview]
Message-ID: <20150302223110.GB3933@cordes.ca> (raw)
In-Reply-To: <20150302201311.GM8046@ws.net.home>

[-- Attachment #1: Type: text/plain, Size: 2921 bytes --]

On Mon, Mar 02, 2015 at 09:13:11PM +0100, Karel Zak wrote:
> On Mon, Mar 02, 2015 at 12:19:32PM -0400, Peter Cordes wrote:
> >  If libfdisk doesn't actually store anything after sector 33, it would
> > be nice if it wrote a GPT to disk that that has sector 34 as the
> > first-usable. 
> 
>  I'm not sure, the common consensus is to use 1MiB offset for the
>  first partition -- then it does not make sense to define
>  FirstUsableLBA smaller, because the extra space between the first
>  partition may be interpreted as gap and later (inadvertently)
>  partitioned.

 If libfdisk-based tools depend on this to avoid showing the user
there's partitionable space before the first partition, then they'll
behave differently when editting GPT partitions written by other tools.
(The widely-used parted sets FirstUsableLBA = 34, and I assume so do
most others.)

 If that's just for the benefit of "other tools", then parted doesn't
need this help.  gparted doesn't seem to offer a way to create
non-1MiB-aligned partitions even if you wanted to.  (IDK about the CLI).

 If a tool doesn't try to enforce alignment, the 2nd partition a user
creates could be un-aligned, if the first partition doesn't end on a
1MiB boundary.  Anyway, IDK how useful this theoretical benefit is to
anyone.

>  Note the I'm talking about default layout, your example with 
>  --dump and restore is different -- sfdisk has to be able to 
>  copy existing partition tables.
>  
>  BTW, the problem should be fixed in git tree, you have to --dump with
>  new sfdisk and then it will add "first-lba" number to scrit header.

 Ok, cool.  It might not be hard to detect scripted partitions
starting below 2048, but above 33, and set first-lba to the lowest
number found.  Or to 34, if a partition before 2048 is found at all.

 Requiring scripts to have a first-lba: 34 is a non-obvious extra step
that might take some debugging time for someone generating a script
from scratch in a program, rather than with sfdisk -d.

>  It would be better to learn partitioning tools to modify
         <englishlesson> teach </englishlesson>  :)
>  FirstUsableLBA in GPT header. I'll probably implement it for v2.27
>  fdisk, so creative users like you will be able to tune up their
>  partition tables :-)

 Yeah, neat.  That could be useful either way, for setting to 2048 in
other tables, as well.

 Thanks again for the quick response and getting a fix in.  I'll use
it to re-copy my partition tables now, before I'm booting from them.
So it should be easy to fix anything that happens because of different
UUIDs.

-- 
#define X(x,y) x##y
Peter Cordes ;  e-mail: X(peter@cor , des.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BC

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 359 bytes --]

  reply	other threads:[~2015-03-02 22:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01 15:56 sfdisk problem with a partition starting early on a GPT disk Peter Cordes
2015-03-02 10:06 ` Karel Zak
2015-03-02 16:19   ` Peter Cordes
2015-03-02 20:13     ` Karel Zak
2015-03-02 22:31       ` Peter Cordes [this message]
2015-03-03  0:21         ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302223110.GB3933@cordes.ca \
    --to=peter@cordes.ca \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox