From 59db52ad473cccc7c0005d99d03c9dd0d41d7797 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 11 Oct 2013 11:38:29 +0200 Subject: [PATCH] libfdisk: treat size mismatch as a warning, not an error Based on kernel patch from Doug Anderson . Signed-off-by: Karel Zak --- libfdisk/src/gpt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 448b1ff79b..6d222061a2 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -509,11 +509,18 @@ check_hybrid: * the disk size. * * Hybrid MBRs do not necessarily comply with this. + * + * Consider a bad value here to be a warning to support dd-ing + * an image from a smaller disk to a bigger disk. */ if (ret == GPT_MBR_PROTECTIVE) { sz_lba = le32_to_cpu(pmbr->partition_record[part].size_in_lba); - if (sz_lba != (uint32_t) cxt->total_sectors - 1 && sz_lba != 0xFFFFFFFF) - ret = 0; + if (sz_lba != (uint32_t) cxt->total_sectors - 1 && sz_lba != 0xFFFFFFFF) { + fdisk_warnx(cxt, _("GPT PMBR size mismatch (%u != %u) " + "will be corrected by w(rite)."), + sz_lba, + (uint32_t) cxt->total_sectors - 1); + } } done: return ret; -- 2.47.3