Re: [Gptfdisk-general] [PATCH] Fix problem resizing RAID disks
Brought to you by:
srs5694
|
From: Rod S. <rod...@ro...> - 2014-02-17 17:24:12
|
On 01/27/2014 06:20 AM, Frediano Ziglio wrote:
> This patch fix a nasty problem using -Z option in some cases if raid type
> is change. The reason is that usually when you change RAID type only first
> part get cleaned so you end up with GPT backup copy (at end) still
> present but at different location.
Thanks for the patch. I've accepted it into the next release of gdisk.
> Imaging you have a RAID0 disk with 2 disk so you have clusters
> alternated with last cluster ending at disk #2 containing the backup
> GPT. You destroy the RAID and create another RAID0 with 4 disks. If disk
> #2 now is disk #4 (last) of new RAID you end up with last cluster
> containing the old GPT. However the LBA information still point to old
> location which now point at the middle of the disk while protective MBR
> and main GPT cleared. In this situation doing a --zap-all command gdisk
> try to load GPTs headers finding the backup. Then it try to zero them
> using LBA informations just read so it clear some sectors in the middle
> of the disk. The result if that disk is not cleared correctly.
>
> The patch fix LBA addresses before writing zeroes clearing correct
> locations.
>
> Signed-off-by: Frediano Ziglio <fre...@ci...>
> ---
> gpt.cc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/gpt.cc b/gpt.cc
> index fa7b661..3244cc9 100644
> --- a/gpt.cc
> +++ b/gpt.cc
> @@ -1314,6 +1314,7 @@ int GPTData::DestroyGPT(void) {
> uint8_t* emptyTable;
>
> memset(blankSector, 0, sizeof(blankSector));
> + ClearGPTData();
>
> if (myDisk.OpenForWrite()) {
> if (!myDisk.Seek(mainHeader.currentLBA))
>
--
Rod Smith
rod...@ro...
http://www.rodsbooks.com
|