This question has been raised in IRC many times during storage-ng
development, with no satisfactory answer so far. But now we need to take
a decision at last.

Storage-ng always tries to align the start and end of all new and
resized partitions for optimal performance. In addition to that, there
is also a given alignment that has to be respected for the whole thing
to work (leaving performance aside). See [1] for more info.

For example, in the case of a typical GPT partition table in a typical
disk, the REQUIRED grain would be 1B (so we can create a partition of
any size), but the OPTIMAL grain is 1MiB (so we try to only distribute
the space in virtual "disk slices" of 1MiB).

In DASD, the typical REQUIRED grain is 48KiB, so no way we can create a
partition whose size is not divisible by that number. In addition, the
OPTIMAL grain is 3MiB.

The point is that I'm not so sure whether aligning the end makes that
much sense from the performance POV if a given partition is at the very
end of the partition table.

Two cases:
==========

1) GPT partition tables.

In GPT the last 16.5KiB are always reserved (a backup of the partition
table).

Let's say the user decides to create a partition using all the available
space at the end (or simply a big partition using the whole disk). A
very common scenario.

What should we do? Persist in our attempt to have everything aligned and
leave a gap of 1007.5Kib at the end or really use the space up until the
end?

If GPT is designed to always have those 16.5KiB stripped from the useful
space, I would assume that having a last "slice" of 1007.5Kib instead of
1MiB shouldn't imply a performance penalty. Otherwise, the GPT design is
rather... well... not-smart.

2) DASD partition tables.

A similar thing happens with DASD. In many situations, the remaining
space at the end of the disk is not divisible by 3MiB. Do we want to
leave the remainder space unused? If we decide to use also those, let's
say, 2MiB at the end of the disk, would we be introducing a performance
problem or that rule does not apply to partitions at the end of the disk?

Even further, it is possible than the remainder is not divisible by the
REQUIRED grain of 48KiB? I wouldn't expect that to happen, but these
eyes have seen so many things... ;-)

In short:
=========

For a partition trying to use the space at the end of the disk:

1) Should we give up on optimal alignment and use REQUIRED alignment for
that case? If we do so, would it have any performance impact?

2) Should we, instead, stick to the OPTIMAL alignment also for that
final partition and leave gaps at the end of all GPT and many (most) DASDs?

3) Should we even go further than (1) and completely ignore alignment
(even the REQUIRED one) assuming that partition tables can always be
used up to the end? (Who would build a disk with unusable space after
all ;-) ).

Thanks guys for the replies.

https://github.com/openSUSE/libstorage-ng/blob/master/doc/alignment.md
-- 
Ancor González Sosa
YaST Team at SUSE Linux GmbH
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to