Tue, 3 Nov 2020 22:44:16 +0100 időpontban David Haller írta:
Hello,
On Tue, 03 Nov 2020, Istvan Gabor wrote:
I have a 250 GB SSD I want to partition with cfdisk. It is from util-linux 2.33.1, default on openSUSE Leap 15.1 I have.
I've set a DOS compatible msdos partition scheme.
The created partitions in cfdisk are:
Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 8390655 8388608 4G 83 Linux /dev/sdb2 8390656 92276735 83886080 40G 83 Linux /dev/sdb3 92276736 176162815 83886080 40G 83 Linux /dev/sdb4 176162816 488397167 312234352 148.9G 5 Extended +-/dev/sdb5 176164864 218107903 41943040 20G 83 Linux
+-/dev/sdb6 218109952 260052991 41943040 20G 83 Linux +-/dev/sdb7 260055040 301998079 41943040 20G 83 Linux +-Free space 302000128 488397167 186397040 88.9G
The primary partitions are aligned right after each other. Eg sdb1 ends at sector 8390655 and sdb starts at 8390656.
cfdisk and basically all other tools by default create partitions aligned on 1MB-boundaries. And rightly so. On SSD it's basically a must, see https://en.wikipedia.org/wiki/Write_amplification
But between logical partitions cfdisk inserts 2048 empty sectors. Eg sdb4 starts at sector 176162816 but sdb5 starts at 176164864.
That's because sda4 needs 1 sector for the so called "EPBR" (same format as an MBR, and you can also write e.g. a stage1 of grub in the unused first 446 bytes of it) that points to the next logical partition.
See: https://en.wikipedia.org/wiki/Extended_boot_record https://en.wikipedia.org/wiki/File:09-02-28-ebr-entry-2.png https://en.wikipedia.org/wiki/Disk_partitioning https://en.wikipedia.org/wiki/Partition_alignment
And a start of sdb5 at 176162817 would not be aligned, and a start 176164864 is the next aligned-on-1MB possibility.
There are 2048 unused sectors between the two.
Nope. 2047!
Similarly, sdb5 ends at 218107903 but sdb6 starts at 218109952.
That is because of how the DOS extended partition works, basically it's a chain of extended partition, so _EACH AND EVERY ONE_ logical partition MUST contain another "EPBR", same thing as with sda4...
Again there are 2048 unused sectors between the two.
Nope, Again, there are 2047 only unused sectors, and the next aligned is used.
1. Why does cfdisk insert these unused spaces between partitions?
Because it must, see above.
2. If I used parted and aligned the extended partitions right after each other (like the primary partitions) would it cause any problem?
It's not possible. And if you did squeeze them to be unaligned (e.g. start at the next possible sector after the EPBR), then (on Flash) (write-)performance and durability would suffer quite a lot.
HTH, -dnh
David, thanks for the detailed explanation. I did now about the 1MB boundary, but did not know about the 1 sector EPBR which explains the 2048 sector/1MB empty space (OK only 2047 sectors are emtpy). Thanks again, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org