[parted-devel] [PATCH] [RFC] Do not automatically update GPT label in interactive mode.
Joel Granados
jgranado at redhat.com
Fri Feb 13 13:15:54 UTC 2009
Hi Peter.
I agree with you on this. This patch is part of the set of patches I will propose for parted for version 1.8.9.
thx for the report.
----- "Petr Uzel" <petr.uzel at suse.cz> wrote:
> Hi all,
>
>
> Previously, when parted was invoked in interactive mode on disk with
> GPT
> label and the backup GPT was not in the last sector of the disk,
> parted
> fixed this automatically. This behavior might be undesirable in the
> following situation:
>
> dm-raid on top of block device. The dm-raid is partitioned with GPT.
> If
> the dm-raid starts on the first block of underlying device (AFAIK this
> is
> the case with FastTrack controllers) and the user runs parted on the
> dm-raid, it will identify the physical device as being partitioned
> with
> GPT and see the backup GPT table not to be in the last sector of the
> physical device and thus move it to this location (which may lead to
> destruction of dm-raid metadata in case they are located at the end
> of
> physical device).
>
> This patch modifies parted's behavior to ignore fixing of backup GPT
> position by default.
> ---
> libparted/labels/gpt.c | 23 +++++++++++++----------
> 1 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
> index 13d2e88..2e765b4 100644
> --- a/libparted/labels/gpt.c
> +++ b/libparted/labels/gpt.c
> @@ -831,21 +831,24 @@ gpt_read (PedDisk * disk)
> char* zeros = ped_malloc (pth_get_size (disk->dev));
>
> #ifndef DISCOVER_ONLY
> - if (ped_exception_throw (
> + switch (ped_exception_throw (
> PED_EXCEPTION_ERROR,
> - PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL,
> + PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL | PED_EXCEPTION_IGNORE,
> _("The backup GPT table is not at the end of the disk, as it "
> "should be. This might mean that another operating system "
> "believes the disk is smaller. Fix, by moving the backup "
> - "to the end (and removing the old backup)?"))
> - == PED_EXCEPTION_CANCEL)
> - goto error_free_gpt;
> + "to the end (and removing the old backup)?"))) {
> + case PED_EXCEPTION_CANCEL:
> + goto error_free_gpt;
> + case PED_EXCEPTION_FIX:
> + write_back = 1;
> + memset (zeros, 0, disk->dev->sector_size);
> + ped_device_write (disk->dev, zeros,
> + PED_LE64_TO_CPU (gpt->AlternateLBA),
> + 1);
> + break;
> + }
>
> - write_back = 1;
> - memset (zeros, 0, disk->dev->sector_size);
> - ped_device_write (disk->dev, zeros,
> - PED_LE64_TO_CPU (gpt->AlternateLBA),
> - 1);
> #endif /* !DISCOVER_ONLY */
> }
> } else { /* primary GPT *not* ok */
> --
> 1.6.0.2
>
>
> --
> Best regards / s pozdravem
>
> Petr Uzel, Packages maintainer
> ---------------------------------------------------------------------
> SUSE LINUX, s.r.o. e-mail: puzel at suse.cz
> Lihovarská 1060/12 tel: +420 284 028 964
> 190 00 Prague 9 fax: +420 284 028 951
> Czech Republic http://www.suse.cz
>
> _______________________________________________
> parted-devel mailing list
> parted-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/parted-devel
--
Joel Andres Granados
Red Hat / Brno Czech Republic
More information about the parted-devel
mailing list