Subject: bug#53138: Handling of shrinked GPT disks

From: Davis <[email-masked]>
Date: Thu, 13 Jan 2022 08:05:55 +0200

> The question I have is, how common a problem is this? While it can
> happen, it is a pretty fine line between losing just the backup GPT and
> losing the end of the last partition (assuming it is fully utilized).
> I'm not sure it's worth adding extra code and the potential for new bugs
> if this isn't a common practice.

I would guess that shrinking the last partition (e.g. using GParted)
and cloning disk using dd is probably a quite common practice - this
method preserves exotic boot loaders, disk/volume IDs and other
things. Also in some situations the size difference between old and
new drive could be less than the free slack space after the last
partition on the old drive (making shrinking unnecessary).
I am not sure how common are the cases when the last partition extends
beyond the end of the drive as the result of copying data without
resizing the partition (I can imagine this would be the case e.g. if
copying data from a failing drive). However I think that even in those
cases parted shouldn't display an empty partition table.

Davis