{"id":148,"date":"2026-11-15T07:52:00","date_gmt":"2026-11-15T07:52:00","guid":{"rendered":"https:\/\/tothepowerof2.com\/blog\/?p=148"},"modified":"2026-11-15T07:22:18","modified_gmt":"2026-11-15T07:22:18","slug":"partition-alignment-powers-of-two-disks","status":"publish","type":"post","link":"https:\/\/tothepowerof2.com\/blog\/partition-alignment-powers-of-two-disks\/","title":{"rendered":"Powers of Two and Disk Partition Alignment"},"content":{"rendered":"<p><strong>TL;DR \/ Summary:<\/strong> Disk partitioning still leans on powers of two, even though modern drives are decimal. Understanding why 512 GiB is not 512 GB\u2014and why alignment still matters\u2014prevents a class of storage surprises.<\/p>\n<h2>The two meanings of a gigabyte<\/h2>\n<p>Drive manufacturers sell in decimal units: 1 GB is one billion bytes. Operating systems and most partitioning tools use binary units: 1 GiB is 1,073,741,824 bytes.<\/p>\n<p>That difference of about seven percent is why a &#8220;500 GB&#8221; drive shows as roughly 465 GiB in a file manager. The drive is not smaller than advertised; the units are different.<\/p>\n<p>Once you know this, the arithmetic stops being mysterious. A 2 TB drive is about 1.82 TiB, and the gap grows with capacity.<\/p>\n<h2>Why alignment still matters<\/h2>\n<p>Older drives had 512-byte sectors and partitions could start anywhere. Modern drives use 4096-byte physical sectors while reporting 512-byte logical sectors, which means a partition that starts at an odd offset forces every write to span two physical sectors.<\/p>\n<p>The result is a read-modify-write cycle on every unaligned write, which costs performance on both SSDs and hard drives. On an SSD it also increases write amplification, which shortens lifespan.<\/p>\n<p>Alignment to 1 MiB is the modern default and is what most partitioning tools do automatically. The problems appear when a partition is created by hand, restored from an old image, or manipulated by a tool that assumes 512-byte sectors.<\/p>\n<ul>\n<li><strong>1 MiB alignment<\/strong> \u2014 the safe default for almost everything<\/li>\n<li><strong>2048 sectors of 512 bytes<\/strong> \u2014 the same thing expressed differently<\/li>\n<li><strong>4096-byte alignment<\/strong> \u2014 sufficient for 4Kn drives<\/li>\n<li><strong>Legacy 63-sector offset<\/strong> \u2014 the classic misalignment, still found in old images<\/li>\n<\/ul>\n<h3>Checking alignment<\/h3>\n<p>Most partitioning tools report the start sector of each partition. Divide the start sector by 2048; if the result is a whole number, the partition is 1 MiB aligned.<\/p>\n<p>A start sector of 63 is the historical misalignment, and it is a reliable sign that an image came from a very old system.<\/p>\n<blockquote><p>If the start sector does not divide evenly, every write pays for it.<\/p><\/blockquote>\n<h2>Partition sizes and the power-of-two habit<\/h2>\n<p>People often create partitions in round binary sizes: 64 GiB, 128 GiB, 256 GiB. This is a habit inherited from an era when sizing was constrained by geometry, and it has no performance benefit today.<\/p>\n<p>Size partitions by use, not by round numbers. A 100 GB partition is easier to reason about than a 95.4 GiB partition that happens to be exactly 100,000 MiB.<\/p>\n<p>The exception is when a tool or a filesystem has a recommended size for a specific role, such as a swap partition or a small boot partition. Follow the recommendation there and ignore round numbers elsewhere.<\/p>\n<h2>Filesystem block sizes<\/h2>\n<p>Block size is a separate decision from partition alignment. A filesystem with a 4 KiB block size is the standard choice for general use; large media stores sometimes benefit from larger blocks.<\/p>\n<p>Smaller blocks waste less space on small files; larger blocks reduce metadata overhead on large files. For a mixed workload, 4 KiB remains the sensible default.<\/p>\n<p>Do not change block size to chase a benchmark. The gain is workload-specific and the cost of getting it wrong is wasted space across an entire volume.<\/p>\n<h2>RAID, striping, and chunk sizes<\/h2>\n<p>RAID chunk sizes are also commonly powers of two: 64 KiB, 128 KiB, 256 KiB. The chunk size should match the typical I\/O pattern.<\/p>\n<p>Large sequential writes favour larger chunks; many small random writes favour smaller ones. A general-purpose array usually works well at 64 or 128 KiB.<\/p>\n<p>Check alignment across the whole stack. A partition that is aligned to 1 MiB, sitting on a RAID volume whose data offset is not aligned, still produces misaligned writes.<\/p>\n<h2>Practical migration notes<\/h2>\n<p>When cloning a drive, verify alignment afterward. Many cloning tools preserve the original layout, including its misalignment.<\/p>\n<p>When restoring a backup to a new disk, check the partition start sectors before booting. A restored image with legacy offsets will work, and it will be slower than it needs to be.<\/p>\n<p>Keep a note of the layout for each machine. A one-line record of sizes and offsets saves an hour the next time the disk is touched.<\/p>\n<h2>Where the arithmetic helps<\/h2>\n<p>Knowing the binary values makes capacity planning honest. If you need 500 GiB of usable space, buy a drive that provides it in binary terms, which means roughly 537 GB decimal.<\/p>\n<p>A quick reference for the values is genuinely useful here; <a href=\"https:\/\/tothepowerof2.com\/\">2 to the power of<\/a> tables are easier than recalculating in your head.<\/p>\n<p>Modern storage is forgiving about most of this, and the two decisions that still matter are alignment and block size. Get those right and the drive will behave predictably for its whole life.<\/p>\n<h2>Virtual disks and guest alignment<\/h2>\n<p>A virtual machine adds another layer where alignment can go wrong. The guest partition must align with the virtual disk, and the virtual disk must align with the host storage.<\/p>\n<p>Modern hypervisors handle the second part, but the guest partition is still the responsibility of whoever installed the guest. Check it after a migration or a restore from an old image.<\/p>\n<p>A guest that was cloned from a physical machine carries the physical layout, including any legacy offsets. That is the most common source of misalignment in virtual environments.<\/p>\n<h3>Encryption headers<\/h3>\n<p>Full-disk encryption adds a header before the first partition, and the header size affects where the partition begins. An installer that does not account for it can produce a misaligned layout.<\/p>\n<p>Check the alignment after enabling encryption, not just before. The check takes a minute and the correction is much easier before data is written.<\/p>\n<p>Record the final layout in the machine&#8217;s notes. Rebuilding from notes is faster than rediscovering the same problems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR \/ Summary: Disk partitioning still leans on powers of two, even though modern drives are decimal. Understanding why 512 GiB is not 512 GB\u2014and why alignment still matters\u2014prevents a class of storage surprises. The two meanings of a gigabyte Drive manufacturers sell in decimal units: 1 GB is one billion bytes. Operating systems and &#8230; <a title=\"Powers of Two and Disk Partition Alignment\" class=\"read-more\" href=\"https:\/\/tothepowerof2.com\/blog\/partition-alignment-powers-of-two-disks\/\" aria-label=\"Read more about Powers of Two and Disk Partition Alignment\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":58,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-binary-exponents-computing"],"_links":{"self":[{"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":1,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":149,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions\/149"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/media\/58"}],"wp:attachment":[{"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tothepowerof2.com\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}