From c17dfa6d1848bcf999ec51a5bf4428dec14dd06e Mon Sep 17 00:00:00 2001
From: Michael Prokop <mprokop@sipwise.com>
Date: Tue, 26 Jan 2016 01:04:47 +0100
Subject: [PATCH] MT#17529 Create partitions using optimal partition table
 alignment

parted supports the "-a optimal" option to get better alignment during partition table setup.

We should use that by default, since it:

a) shouldn't cause any harm on VMs anyway and
b) might improve performance especially on SSDs with non-standard
   optimal_io_size settings (as observed on a Samsung EVA 850
   with a setting of 33553920, so the partition should start
   at 33.6MB and not 1MiB/2048s)

NOTE: fai-setup-storage doesn't support setting the parted options
like "-a optimal" yet, reported as #812712 in Debian's BTS.

Change-Id: Ib1c49d4f2b405697f0dcac5f164473ea9f87557c
---
 deployment.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/deployment.sh b/deployment.sh
index 6f93ab9..4097633 100755
--- a/deployment.sh
+++ b/deployment.sh
@@ -1165,11 +1165,11 @@ EOF
   ROOT_FS="/dev/mapper/${VG_NAME}-root"
   SWAP_PARTITION="/dev/mapper/${VG_NAME}-swap"
 
-else # no LVM (default)
-  parted -s /dev/${DISK} mktable "$TABLE" || die "Failed to set up partition table"
+else # no LVM
+  parted -s -a optimal /dev/${DISK} mktable "$TABLE" || die "Failed to set up partition table"
   # hw-raid with rootfs + swap partition
-  parted -s /dev/${DISK} 'mkpart primary ext4 2048s 95%' || die "Failed to set up primary partition"
-  parted -s /dev/${DISK} 'mkpart primary linux-swap 95% -1' || die "Failed to set up swap partition"
+  parted -s -a optimal /dev/${DISK} 'mkpart primary ext4 2048s 95%' || die "Failed to set up primary partition"
+  parted -s -a optimal /dev/${DISK} 'mkpart primary linux-swap 95% -1' || die "Failed to set up swap partition"
   sync
 
   # used later by installer