This commit is contained in:
parent
19b4391da3
commit
5d7c9c25ff
67
do-not-automatically-correct-GPT.patch
Normal file
67
do-not-automatically-correct-GPT.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From d7d9f2c40c6bb3e83a7e6ea3164b4f4eb7440a47 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Uzel <petr.uzel@suse.cz>
|
||||
Date: Fri, 13 Feb 2009 13:27:55 +0100
|
||||
Subject: [PATCH] gpt: do not automatically "correct" a suspicious GPT partition table
|
||||
|
||||
Previously, when parted was invoked on a disk with a GPT partition table
|
||||
and the backup GPT was not in the last sector of the disk, and even if
|
||||
the requested operation was just to print the partition table, parted
|
||||
would "repair" this automatically. This behavior is 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 | 25 +++++++++++++++----------
|
||||
1 files changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
Index: parted-1.8.8/libparted/labels/gpt.c
|
||||
===================================================================
|
||||
--- parted-1.8.8.orig/libparted/labels/gpt.c
|
||||
+++ parted-1.8.8/libparted/labels/gpt.c
|
||||
@@ -836,21 +836,26 @@ 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;
|
||||
+ default:
|
||||
+ 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,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 18 11:22:22 CET 2009 - puzel@suse.cz
|
||||
|
||||
- do-not-automatically-correct-GPT.patch (bnc#436825)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 10 11:21:52 CET 2009 - puzel@suse.cz
|
||||
|
||||
|
@ -26,7 +26,7 @@ License: GPL v2 or later
|
||||
Group: System/Filesystems
|
||||
Summary: GNU partitioner
|
||||
Version: 1.8.8
|
||||
Release: 100
|
||||
Release: 103
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
Patch: always-resize-part.dif
|
||||
Patch1: parted-type.patch
|
||||
@ -54,6 +54,7 @@ Patch62: fix-error-informing-the-kernel.patch
|
||||
Patch63: do-not-discard-bootcode-in-extended-partition.patch
|
||||
Patch64: parted-cmd-arg-fix.patch
|
||||
Patch65: dont-require-dvh-partition-name.patch
|
||||
Patch66: do-not-automatically-correct-GPT.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Url: http://www.gnu.org/software/parted/
|
||||
PreReq: %install_info_prereq
|
||||
@ -127,6 +128,7 @@ Authors:
|
||||
%patch63 -p1
|
||||
%patch64 -p1
|
||||
%patch65 -p1
|
||||
%patch66 -p1
|
||||
|
||||
%build
|
||||
AUTOPOINT=true autoreconf --force --install
|
||||
@ -171,6 +173,8 @@ rm -rf "$RPM_BUILD_ROOT"
|
||||
%{_libdir}/*.so
|
||||
|
||||
%changelog
|
||||
* Wed Feb 18 2009 puzel@suse.cz
|
||||
- do-not-automatically-correct-GPT.patch (bnc#436825)
|
||||
* Tue Feb 10 2009 puzel@suse.cz
|
||||
- dont-require-dvh-partition-name.patch (bnc#471703)
|
||||
* Mon Feb 09 2009 puzel@suse.cz
|
||||
|
Loading…
x
Reference in New Issue
Block a user