bios_grub {size}->{range} appears incorrect

andrew bezella abezella at archive.org
Fri Feb 24 21:19:11 CET 2012


hello -

i didn't see this as either a fixed or an outstanding bug (apologies if
i just missed it), but i am experiencing an issue when trying to use a
gpt-bios disklabel on a 3tb drive, namely that a 0-100% allocation uses
much less than the whole disk.  i'm running fai 3.4.8; i also upgraded
(just) the fai-setup-storage pkg in the live nfsroot to 4.0~beta3
+experimental7 (setup-storage 1.3+exp) but saw the same result.

excerpt from disk_config: 
disk_config sda disklabel:gpt-bios align-at:4K
primary -       0-100%  -       -

excerpt from the format.log: 
Executing: parted -s /dev/sda mklabel gpt
Executing: parted -s /dev/sda mkpart primary "" 1069056B 1901081333759B
Executing: parted -s /dev/sda mkpart primary "" 17408B 1065983B

identifies the disk and its size correctly (3000592961535B per
`setup-storage -d`).

when i started poking around Sizes.pm, it looks like the values in
$FAI::partition_pointer->{size}->{range} for the bios_grub partition are
run through the make_range function twice.  the first time is in
compute_partition_sizes where the range of "1-1" is converted from bytes
to megabytes.  the second time is in do_partition_real.  so the range
that goes in this second time is (1 * 1024 * 1024) and the min_size
variable that comes out is (1 * 1024 * 1024 * 1024 * 1024) =
1099511627776B.  and 3000592961535B - 1099511627776B = 1901081333759B,
which is what i was seeing above.

a workaround appears to be the following one-line patch to keep the
range in megabytes: 
--- ./Sizes.pm.orig     2012-02-23 18:37:03.388348728 -0800
+++ ./Sizes.pm  2012-02-23 18:36:49.028344316 -0800
@@ -651,7 +651,7 @@
         (&FAI::phys_dev($FAI::partition_pointer_dev_name))[2];
       my ($s, $e) = &FAI::make_range("1-1", $current_disk->{size} . "B");
       # enter the range into the hash
-      $FAI::partition_pointer->{size}->{range} = "$s-$s";
+      $FAI::partition_pointer->{size}->{range} = "1-1";
       # retain the free space at the beginning and fix the position
       $FAI::partition_pointer->{start_byte} = $next_start;
       $FAI::partition_pointer->{end_byte} = $next_start + $s - 1;

i didn't notice any other adverse effects and the installation completed
as expected.

should i file this as a bug?

thank you!

andy

-- 
andrew bezella <abezella at archive.org>
Internet Archive




More information about the linux-fai mailing list