[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#510544: Installer/partition guide tried to use 500GB as swap



clone 510544 -1
severity -1 wishlist
retitle -1 Possible simplification of partition/LV size calculation
thanks

On Friday 09 January 2009, Ferenc Wagner wrote:
> To the point: perform_recipe_by_lvm determines free space in binary
> kilobytes [kiB] by:
>
> free_size=$(vgs -o vg_free --units k --noheading --nosuffix $VG_name |
> sed -e 's/\..*//g'
>
> so expand_scheme determines partition sizes in kiB as well (even
> though originally it had them in MB and then scaled to kB -- for some
> unknown reason -- before starting the whole process).
>
> Then lvm_extents_from_human in lvm-base.sh assumes SI kilobytes [kB]
> to compute the number of extents to create the LV with, which thus
> gets a factor of 1024/1000 smaller than expected.  This wouldn't be
> noticeable in itself, as the difference is small compared to the size
> of the LV, but it's about the size of the swap LV, which is created
> last and uses up all remaining space and thus gets twice as large as
> expected.

Thanks for the excellent analysis.

> Sorry for the painstaking detail.  The fix is to use kB units in
> calculating the free space:
>
> free_size=$(vgs -o vg_free --units K --noheading --nosuffix $VG_name |
> sed -e 's/\..*//g'

I have committed and uploaded this change.

> Now.  If at the same time I scrap the whole kB scheme and stick to MB
> as usual, the original problem disappears, too.  With the attached
> patch I get the following result, which I consider perfect:

AFAICT that cleanup is also correct, but IMO it is not suitable as a 
last-minute change for Lenny. Cloning the BR as a reminder to work on 
this after the release.

> The following patch contains an unnecessary change as well: lcreate
> can use up all remaining space by itself, there is no reason to work
> on determining that by hand from the VG info.  Just use 100%FREE.

This looks correct as well, but we should then do the same in partman-lvm 
in choose_partition/lvm/do_option.

Cheers,
FJP



Reply to: