From b6263c18013e99bab1938d112fc927f948df3eef Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 23 Aug 2011 15:25:28 +0100 Subject: [PATCH] Fix parted sector size assumption Parted does not report disk size in 512 byte units, but rather the disks' logical sector size, which with modern drives might be 4k. * src/storage/parthelper.c: Remove hardcoded 512 byte sector size --- src/storage/parthelper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c index acc9171904..964aa780d2 100644 --- a/src/storage/parthelper.c +++ b/src/storage/parthelper.c @@ -157,17 +157,17 @@ int main(int argc, char **argv) part->num, '\0', type, '\0', content, '\0', - part->geom.start * 512llu, '\0', - (part->geom.end + 1 ) * 512llu, '\0', - part->geom.length * 512llu, '\0'); + part->geom.start * dev->sector_size, '\0', + (part->geom.end + 1 ) * dev->sector_size, '\0', + part->geom.length * dev->sector_size, '\0'); } else { printf("%s%c%s%c%s%c%llu%c%llu%c%llu%c", "-", '\0', type, '\0', content, '\0', - part->geom.start * 512llu, '\0', - (part->geom.end + 1 ) * 512llu, '\0', - part->geom.length * 512llu, '\0'); + part->geom.start * dev->sector_size, '\0', + (part->geom.end + 1 ) * dev->sector_size, '\0', + part->geom.length * dev->sector_size, '\0'); } part = ped_disk_next_partition(disk, part); }