tags 411943 + patch
thanks
On Sun, May 25, 2008 at 06:09:33AM -0400, Avery Fay wrote:
> I think this bug is quite high priority and should definitely be fixed
> for Lenny. I recently installed from a debian installer snapshot and
> manually partitioning LVM was nearly impossible. It may not make much of
> a difference when you're partitioning 20 GB or so, but the drive I was
> partitioning was 300 GB. You're forced to play "guess and check" and
> given the inefficiencies of a text installer it's painful.
The attached patch should fix the issue. Details in its header.
PS: The changelogs might be quite bogus as I decided to tackle this
issue while working on other aspects of partman-lvm.
Cheers,
--
Jérémy Bobbio .''`.
lunar@debian.org : :Ⓐ : # apt-get install anarchism
`. `'`
`-
commit cccad52a7fb1207ade93d574b5de6fbc4488903a
Author: Jérémy Bobbio <lunar@debian.org>
Date: Sat Jul 19 22:34:58 2008 +0000
Harmonize size specification used for new LVs
Previously, the size given when creating a new Logical Volume was given
directly to lvcreate. The later uses size units as multiple of 1024
whereas the rest of partman uses size units as multiple of 1000.
In order to solve this, we now gives LVM extents to lvcreate instead of
size. The following was modified in lib/lvm-base.sh:
- lv_create() now uses extents instead of size,
- lvm_size_from_human() has been renamed to
lvm_extents_from_human(),
- As extent sizes are specific to a given Volume
Group, lvm_extents_from_human() take the VG name as its first
argument.
do_lv_create() in partman-lvm and perform_recipe_by_lvm in
partman-auto-lvm were modified accordingly.
(Closes: #411943)
diff --git a/packages/partman/partman-auto-lvm/debian/changelog b/packages/partman/partman-auto-lvm/debian/changelog
index 7200752..cae714e 100644
--- a/packages/partman/partman-auto-lvm/debian/changelog
+++ b/packages/partman/partman-auto-lvm/debian/changelog
@@ -1,3 +1,11 @@
+partman-auto-lvm (28) UNRELEASED; urgency=low
+
+ [ Jérémy Bobbio ]
+ * Update perform_recipe_by_lvm to use extents when calling lv_create().
+ Depends: partman-lvm (>= 62)
+
+ -- Jérémy Bobbio <lunar@debian.org> Sat, 19 Jul 2008 22:29:05 +0000
+
partman-auto-lvm (27) unstable; urgency=low
[ Updated translations ]
diff --git a/packages/partman/partman-auto-lvm/debian/control b/packages/partman/partman-auto-lvm/debian/control
index f0cc25c..57785c2 100644
--- a/packages/partman/partman-auto-lvm/debian/control
+++ b/packages/partman/partman-auto-lvm/debian/control
@@ -9,5 +9,5 @@ Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/partman/partman-auto-lvm
Package: partman-auto-lvm
XC-Package-Type: udeb
Architecture: all
-Depends: ${misc:Depends}, partman-base (>= 114), partman-auto (>= 74), partman-lvm (>= 58), di-utils (>= 1.15)
+Depends: ${misc:Depends}, partman-base (>= 114), partman-auto (>= 74), partman-lvm (>= 62), di-utils (>= 1.15)
Description: Automatically partition storage devices using LVM
diff --git a/packages/partman/partman-auto-lvm/perform_recipe_by_lvm b/packages/partman/partman-auto-lvm/perform_recipe_by_lvm
index c530104..d7f9abc 100755
--- a/packages/partman/partman-auto-lvm/perform_recipe_by_lvm
+++ b/packages/partman/partman-auto-lvm/perform_recipe_by_lvm
@@ -73,9 +73,11 @@ foreach_partition '
fi
if [ "$last" = yes ]; then
- lv_create $VG_name "$lvname" full || autopartitioning_failed
+ vg_get_info "$VG_name"
+ lv_create $VG_name "$lvname" $FREEPE || autopartitioning_failed
else
- lv_create $VG_name "$lvname" $(($1/1024)) || autopartitioning_failed
+ extents=$(lvm_extents_from_human $VG_name "${1}K")
+ lv_create $VG_name "$lvname" $extents || autopartitioning_failed
fi
# Hyphens in VG or LV names are doubled under /dev/mapper
diff --git a/packages/partman/partman-lvm/choose_partition/lvm/do_option b/packages/partman/partman-lvm/choose_partition/lvm/do_option
index 8fba4dc..bdb7b18 100755
--- a/packages/partman/partman-lvm/choose_partition/lvm/do_option
+++ b/packages/partman/partman-lvm/choose_partition/lvm/do_option
@@ -298,7 +298,7 @@ do_vg_reduce() {
}
do_lv_create() {
- local vgs vg output lv size max_size
+ local vgs vg output lv size extents max_size
# Find eligible VGs
vgs=""
@@ -359,17 +359,18 @@ do_lv_create() {
db_go || return
db_get partman-lvm/lvcreate_size
[ -n "$RET" ] || return
- size=$(lvm_size_from_human "$RET")
+ size="$RET"
+ extents=$(lvm_extents_from_human "$vg" "$size")
# If the maximum free space should be used for the new LV, use the
# number of physical extents (PEs) because the size given by LVM
# might not be accurate, resulting in an error because the VG is
# not big enough (see #250594).
if [ "$size" = "$max_size" ]; then
- size=full
+ extents=$FREEPE
fi
- if ! lv_create "$vg" "$lv" "$size"; then
+ if ! lv_create "$vg" "$lv" "$extents"; then
db_subst partman-lvm/lvcreate_error VG $vg
db_subst partman-lvm/lvcreate_error LV $lv
db_subst partman-lvm/lvcreate_error SIZE $RET
diff --git a/packages/partman/partman-lvm/debian/changelog b/packages/partman/partman-lvm/debian/changelog
index 3c30331..21856c9 100644
--- a/packages/partman/partman-lvm/debian/changelog
+++ b/packages/partman/partman-lvm/debian/changelog
@@ -7,6 +7,12 @@ partman-lvm (62) UNRELEASED; urgency=low
activating Volume Groups,
- lvm, run later, will ensure that Physical Volumes have "lvm" as
method, and create free space for Logical Volumes if needed.
+ * Harmonize size specification used when creating new Logical Volumes:
+ - lv_create() now uses extents instead of size,
+ - lvm_size_from_human() has been renamed to lvm_extents_from_human(),
+ - As extent sizes are specific to a given Volume Group,
+ lvm_extents_from_human() take the VG name as its first argument.
+ Breaks: partman-auto-lvm (<= 27) (Closes: #411943)
-- Jérémy Bobbio <lunar@debian.org> Sat, 19 Jul 2008 19:02:55 +0000
diff --git a/packages/partman/partman-lvm/lib/lvm-base.sh b/packages/partman/partman-lvm/lib/lvm-base.sh
index 5adc657..b4e1337 100644
--- a/packages/partman/partman-lvm/lib/lvm-base.sh
+++ b/packages/partman/partman-lvm/lib/lvm-base.sh
@@ -11,9 +11,14 @@ export LVM_SUPPRESS_FD_WARNINGS=1
###############################################################################
# Convert common terms for disk sizes into something LVM understands.
-# e.g. "200 gb" -> "200G"
-lvm_size_from_human() {
- echo "$1" | tr "kmgt" "KMGT" | sed -e 's/[[:space:]]//g;s/\([KMGT]\)[bB]/\1/'
+# e.g. "200 gb" -> "47683"
+lvm_extents_from_human() {
+ local vg size extent_size
+ vg="$1"
+ size="$2"
+
+ extent_size=$(vgs --noheadings --units K -o vg_extent_size "$vg")
+ echo $(($(human2longint "$size") / $(human2longint "$extent_size")))
}
# Convert LVM disk sizes into something human readable.
@@ -314,20 +319,12 @@ lv_list() {
# Create a LV
lv_create() {
- local vg lv size
+ local vg lv extents
vg="$1"
lv="$2"
- size="$3"
+ extents="$3"
- if [ "$size" = full ]; then
- vg_get_info "$vg"
- if [ "$FREEPE" -lt 1 ]; then
- return 1
- fi
- log-output -t partman-lvm lvcreate -l "$FREEPE" -n "$lv" "$vg"
- else
- log-output -t partman-lvm lvcreate -L "$size" -n "$lv" $vg
- fi
+ log-output -t partman-lvm lvcreate -l "$extents" -n "$lv" $vg
return $?
}
Attachment:
signature.asc
Description: Digital signature