Subject: bug#22180: Partition alignment using parted

From: Ankur Tank <[email-masked]>
Date: Sat, 2 Jan 2016 15:27:06 +0000

Hi Phillip,

Finally I could achieve optimal alignment for all partitions except initial 3 partition(which I can't change).
Except initial 3 SPL partitions i have changed minimum partition size to 1MiB and now parted complains about alignment for only initial 3 partitions.
I have updated below Stackexchange post with latest script,
http://unix.stackexchange.com/questions/248939/how-to-achieve-optimal-alignment-for-emmc-partition

However I am not clear with one simple thing, that is,
Why parted behaves different when I give partition size in KiB and MiB?

I have to create partition with size in KiB i have to give end as (end -1) e.g.

parted --script -a optimal /dev/mmcblk0 \
  mklabel gpt \
  mkpart primary 128KiB 255KiB \
  mkpart primary 256KiB 383KiB \
  mkpart primary 384KiB 511KiB \
Observe end argument in all 3 partitions they are 256-1, 384-1 and 512-1

However if I have to give size in MiB parted allows me to use exact 1 MiB boundry,

parted --script -a optimal /dev/mmcblk0 \
  mklabel gpt \
  mkpart primary 128KiB 255KiB \
  mkpart primary 256KiB 383KiB \
  mkpart primary 384KiB 511KiB \
  mkpart primary 1MiB 2MiB \
  mkpart primary 2MiB 3MiB \
  mkpart primary 3MiB 4MiB \

Observe last three partitions, end of the one partition is the beginning of the second partition in case size mentioned in MiB which is not possible if size is given in KiB.
Why is that, any suggestions/pointers for that ?

Thank you for all help,

Regards,
Ankur
________________________________________
From: Phillip Susi [[email-masked]]
Sent: Saturday, December 26, 2015 7:08 AM
To: Ankur Tank; [email-masked]
Cc: [email-masked]
Subject: Re: bug#22180: Partition alignment using parted

On 12/24/2015 05:51 AM, Ankur Tank wrote:
> Thank you for replying Phillip, 1. How do we measure performance
> improvement before and after partition alignment ?

hdparm -t or dd between the drive and /dev/null or /dev/zero and the
drive ( for a destructive write test ).

> 2. By above question, I meant, are there any tools/utilities
> available which would suggest partition alignment parameters(e.g.
> how many blocks current partition can be moved to get alignment) ?

Not that I am aware of but it is simply a matter of dividing the
current start position by the desired alignment and seeing if you get
a remainder or fractional result.

parted's align-check command does this, but simply answers with a
yes/no as to whether it is aligned instead of how far off it is.

L&T Technology Services Ltd

www.LntTechservices.com<http://www.lnttechservices.com/>

This Email may contain confidential or privileged information for the intended recipient (s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.