On Thursday, 1 April 2021 03:04:31 BST William Kenworthy wrote:
> On 1/4/21 12:39 am, Peter Humphrey wrote:
> > Hello list,
> >
> > I use gparted often, usually from SystemRescueCD, and a common task is to
> > move partitions to allow for one to be enlarged. I should be able to
> > specify all the operations in a list, but whenever I do that gparted
> > inserts 1MB gaps between partitions, so I have to do one at a time. Even
> > the latest bootable gparted CD image does the same.
> >
> > Can anyone tell me what causes this? Has it anything to do with my always
> > specifying partition size as a power of 8? (I'm of the old school, having
> > been sent on my first computer hardware course in 1972.)
>
> Forcing alignment on megabyte boundaries? - I cant find a reason, but I
> think I read in the past it was for efficiency with modern file systems.
>
> BillK
Yes, 4K physical sector size and partition alignment, ubiquitous on modern
'Advanced Format' drives, is used by all partitioning tools these days.
There are many references in the interwebs, but in summary modern AF spinning
drives have 4096 byte physical sector size with a 512 byte logical sector
size. To ensure alignment you could start a partition at an LBA divisible by
8, but since Microsoft came out with Vista's partition manager a convention of
1MB has been set as the starting point:
512 * 2048 = 1,048,576
The 1MB (2048 logical sectors) convention for the start of a partition is used
to cater for various hardware and partitioning requirements, inc. different
RAID data stripe sizes, SSDs with different erase block sizes, etc. It
ensures logical-physical partition alignment to optimise performance when
delete/write operations take place and as long as you are not trying to
squeeze the very last ounce of usable space out of your terabytes of storage,
it achieves its stated aim.
Parted has 3 options for aligning the start of a partition: none, minimal and
optimal. With 'none' it will start a partition wherever you ask it, without
paying heed to logical-to-physical sector alignment. With 'minimal' it will
shift the start/end of a partition to make sure the minimum alignment between
logical and physical sectors is achieved. With 'optimal' it will check if the
partition is aligned to a multiple of the physical block size. 'Optimal' is
the default. You could check/set the alignment of logical-physical sectors
yourself, by making sure the start of your partitions is divisible by 8,
instead of adopting the GParted 1MB default boundary in any cases where it is
not necessary.