Util-Linux package development
 help / color / mirror / Atom feed
From: Scott Moser <smoser@ubuntu.com>
To: util-linux@vger.kernel.org
Subject: GPT writing of unknown partition uuids
Date: Tue, 14 Jul 2015 16:16:56 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1507141610310.21273@brickies> (raw)

Hi,

I came to send the previous patch after realizing that the following is a
lossy operation if the GUID type for the partition is not known to sfdisk.

$ img="/tmp/my.img"
$ size="100M"

$ rm -f "$img"
$ truncate --size "$size" "$img"
$ GPT_PREP="9E1A2D38-C612-4316-AA26-8B49521E5A8B"
$ PT1_UUID="7EB5EBCA-1611-431B-9C80-D87300B41B3B"
$ LABEL_UUID="3C5AD185-CFBF-480D-B80C-AD089E073AC9"

$ sfdisk "$img" <<EOF
label: gpt
label-id: $LABEL_UUID
unit: sectors
1 : start=2048, size=16384, type=$GPT_PREP, uuid=$PT1_UUID
EOF

If sfdisk does not know the uuid provided, it silently falls back to
0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem).

It seems like if the user provided you with a GUID, sfdisk should trust
them, or at very least exit failure if it refuses to use the provided
GUID.

Thoughts?
Scott

             reply	other threads:[~2015-07-14 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 20:16 Scott Moser [this message]
2015-07-15  0:37 ` GPT writing of unknown partition uuids Dale R. Worley
2015-07-15 13:28   ` Scott Moser
2015-07-15 13:42 ` Karel Zak
2015-07-15 14:56   ` Scott Moser
2015-07-15 15:02     ` Karel Zak
2015-07-15 15:09     ` Vadim Kochan
2015-07-15 15:12       ` Vadim Kochan

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=alpine.DEB.2.02.1507141610310.21273@brickies \
    --to=smoser@ubuntu.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