diff options
author | Karel Zak | 2013-10-11 11:38:29 +0200 |
---|---|---|
committer | Karel Zak | 2013-10-11 11:38:29 +0200 |
commit | 59db52ad473cccc7c0005d99d03c9dd0d41d7797 (patch) | |
tree | ab08fc1f9d55271f86448ddac14b3d68e5117373 /libfdisk | |
parent | blockdev: add note about --setbsz usability (diff) | |
download | kernel-qcow2-util-linux-59db52ad473cccc7c0005d99d03c9dd0d41d7797.tar.gz kernel-qcow2-util-linux-59db52ad473cccc7c0005d99d03c9dd0d41d7797.tar.xz kernel-qcow2-util-linux-59db52ad473cccc7c0005d99d03c9dd0d41d7797.zip |
libfdisk: treat size mismatch as a warning, not an error
Based on kernel patch from Doug Anderson <dianders@chromium.org>.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/gpt.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 448b1ff79..6d222061a 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; |