2

I'm following this guide to install Gentoo, in my case in a virtual machine.

During partitioning with parted there is 1 MiB missing at the beginning of all space allocation and 1 MiB missing at the end. There is an example of this in the guide, when (parted) print is invoked.

In my case, I allocated a disk with exactly 200 GiB for this VM, which translates into 204800 MiB. I was expecting the first partition to begin at 0 MiB and the last partition to end at 204800 MiB. But the space allocated begins at 1 MiB and ends at 204799 MiB as the following image shows:

enter image description here

The last partition was allocated with (parted) mkpart primary 5121 -1.

Why is space missing: 1 MiB before the first partition and 1 MiB after the last partition?

  • Screenshots are evil! If you can, use text copy-paste! – peterh - Reinstate Monica Nov 15 '17 at 12:44
  • @peterh This was during the setup screen in a VM, not a "standard" terminal. I tried copying the text but couldn't so resorted to taking a screenshot. – Daniel Nov 15 '17 at 15:04
9

The space reserved before is known as partition alignment; 1MiB is reserved by default by parted.

It is reserved usually for performance reasons, either in physical media or in VMs.

see Partition Alignment

Partition alignment is understood to mean the proper alignment of partitions to the reasonable boundaries of a data storage device (such as a hard disk, solid-state drive (SSD) or RAID volume).
Proper partition alignment ensures ideal performance during data access. Incorrect partition alignment will cause reduced performance, especially with regard to SSDs (with an internal page size of 4,096 or 8,192 bytes, for example), hard disks with four-kilobyte (4,096 byte) sectors and RAID volumes.

see also Guest OS Partition Alignment

An unaligned partition results in the I/O crossing a track boundary and causes an additional I/O. This incurs a penalty on latency and throughput. The additional I/O (especially if small) can impact system resources significantly on some host types. An aligned partition ensures that the single I/O is serviced by a single device, eliminating the additional I/O and resulting in overall performance improvement.

| improve this answer | |
  • Do you know why there is also 1 MiB missing after the last partition? – Daniel Aug 15 '17 at 18:35
  • alignment/ size calculation artifacts I suspect. Not finding a link which explanation pleases me. – Rui F Ribeiro Aug 15 '17 at 18:43
1

The End value is the start of the last MiB of the disk. Since you have that MiB as well, you're not missing anything. You might want to compare the same values in bytes instead of MiB to see it clearer, try parted /dev/sdX unit B print.

| improve this answer | |
  • The last MiB appears to be unused, otherwise the partition size would be one more MiB than it is: 199678 MiB + 1 MiB. (When using the unit B: last partition ends at 214747316223, which is the same as 204799 MiB - 1 Byte. And the reported total size for the partition is 209377558528 B, which matches the previously reported size of 199678 MiB. Nothing really changed except the size is now reported in Bytes, and still not clear to me why the missing Byte.) – Daniel Aug 16 '17 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.