From 15b6bd76f1d99e254204cdfb063d63d2eded1cdf Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 3 Aug 2009 12:46:17 +0000 Subject: allocate image file matching number of cylinders (and not truncated) --- draklive | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/draklive b/draklive index 176bfb8..b246f1e 100755 --- a/draklive +++ b/draklive @@ -691,15 +691,16 @@ sub allocate_master { sectors => 63, # sectors per track }; - my $disk_sectors = fold_left { $::a + $::b } map { $_->{size} } @{$live->{media}{partitions}}; - $disk_sectors += $geom->{sectors}; # keep one more track - $geom->{cylinders} = int($disk_sectors / ($geom->{sectors} * $geom->{heads})); + my $required_sectors = fold_left { $::a + $::b } map { $_->{size} } @{$live->{media}{partitions}}; + $required_sectors += $geom->{sectors}; # keep one more track + $geom->{cylinders} = int($required_sectors / ($geom->{sectors} * $geom->{heads})); + my $total_sectors = $geom->{cylinders} * $geom->{heads} * $geom->{sectors}; mkdir_p(dirname($dest)); - MDV::Draklive::Utils::device_allocate_file($dest, $disk_sectors * $common::SECTORSIZE); + MDV::Draklive::Utils::device_allocate_file($dest, $total_sectors * $common::SECTORSIZE); my $hd = bless { - totalsectors => $geom->{cylinders} * $geom->{heads} * $geom->{sectors}, + totalsectors => $total_sectors, geom => $geom, file => $dest, }, 'partition_table::dos'; -- cgit v1.2.1