[Bug 1303903] Re: sgdisk zap/clear doesn't wipe all GPT tables
Ryan Harper
1303903 at bugs.launchpad.net
Fri Mar 20 16:31:49 UTC 2015
On Wed, Mar 18, 2015 at 12:59 PM, Roderick Smith <rod.smith at canonical.com>
wrote:
> This is not a bug in sgdisk; it's either a bug in the charm or an
> incorrect use of same. Specifically, the sgdisk command shown is:
>
> sgdisk --zap-all --clear --mbrtogpt /dev/vdb
>
> This command does four things, in sequence:
>
> - It zaps all GPT and MBR data structures (--zap-all).
> - It creates an empty GPT data structure (--clear).
> - It OKs the conversion of any MBR data structure to GPT form (--mbrtogpt).
> - It writes the resulting changes to disk. (This is implicit in most uses
> of sgdisk.)
>
> The first and second of those options are both used to wipe data, but in
> different ways -- --zap-all zeroes out all the sectors of the disk used
> by the GPT data structures, whereas --clear erases the partitions but
> leaves the data structures intact. Using --clear after --zap-all should
> therefore have the same effect as using --clear alone. (There may be
> cases where --zap-all would be necessary if you're dealing with a
> damaged disk, but I'd need to study this some more to be sure.) In any
> event, the end result of those two commands is a GPT disk with no
> partitions defined, not a disk without a partition table.
>
> The --mbrtogpt option is useless in this context. It should be used when
> you want to convert an MBR disk to GPT form, but as the preceding
> options set the disk up as GPT, --mbrtogpt does nothing.
>
> If the goal is to completely erase all partition data, including the
> partition table itself, the following command should be used:
>
> sgdisk --zap-all /dev/vdb
>
Thanks for the clarification. Looking into the charm-helpers history it
appears there
was some creep in use of the command.
Originally it was as above, --zap-all DEVICE,
This bug was encountered:
https://bugs.launchpad.net/ubuntu-advantage/+bug/1257491
Which then introduced the use of --mbrtogpt
Further errors were encountered and --clear was added, which resulted in
re-writing of an empty, but clear partition.
Knowing now that it writes out an empty, but present GPT table then issues
manifested itself in a separate case; when this disk was re-used to create
an
LVM, the empty but present GPT table prevented LVM from using the device.
Backing up then, the question is why doesn't --zap-all work for bug
1257491?
If that can be resolved then we can remove the mbrtogpt and clear
altogether
and ensure that nothing is present on the disk so it can be used for ceph
or lvm
block services.
Ryan
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to gdisk in Ubuntu.
https://bugs.launchpad.net/bugs/1303903
Title:
sgdisk zap/clear doesn't wipe all GPT tables
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gdisk/+bug/1303903/+subscriptions
More information about the Ubuntu-server-bugs
mailing list