Make partition alignment configurable
authorIustin Pop <iustin@google.com>
Wed, 9 May 2012 02:34:05 +0000 (04:34 +0200)
committerIustin Pop <iustin@google.com>
Wed, 9 May 2012 06:57:03 +0000 (08:57 +0200)
So that people with special requirements (e.g. SSDs with unusual block
allocations) can customise it for their setup.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

common.sh.in
defaults

index 90924d4..04d339f 100644 (file)
@@ -92,7 +92,7 @@ format_disk0() {
   # head/sectors for devices such as drbd which don't
   # report geometry
   sfdisk -H 64 -S 32 -u S --quiet --Linux "$1" <<EOF
-2048,,L,*
+${PARTITION_ALIGNMENT},,L,*
 EOF
 }
 
@@ -149,6 +149,7 @@ fi
 : ${VARIANTS_DIR:="@sysconfdir@/ganeti/instance-debootstrap/variants"}
 : ${GENERATE_CACHE:="yes"}
 : ${CLEAN_CACHE:="14"} # number of days to keep a cache file
+: ${PARTITION_ALIGNMENT:=2048} # sectors to align partition (1Mib default)
 if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
   DEFAULT_PARTITION_STYLE="none"
 else
index 2443d2f..407be16 100644 (file)
--- a/defaults
+++ b/defaults
@@ -63,3 +63,10 @@ CLEAN_CACHE="14"
 # The default is "msdos" from ganeti 2.0 onwards, but none if installing under
 # Ganeti 1.2 (os api version 5)
 # PARTITION_STYLE="none"
+
+# PARTITION_ALIGNMENT: the alignment of the partitions in sectors
+# (512B); this defaults to 1MiB to give grub enough space for
+# embedding and for better alignment with modern media (HDDs and
+# SSDs), feel free to increase it if your media has even bigger
+# allocation blocks
+# PARTITION_ALIGNMENT=2048