The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
 

Advanced Format Hard Drive

1.0 Advanced Format Hard Drive
       512e Emulation of Traditional Format Hard Drive
       4Kn Native 4K Sector Hard Drive
       Partition Alignment for Advanced Format Hard Drive
       Identifying Advanced Format Hard Drive
1.1 Partitioning Advanced Format Hard Drive
           Automatic Alignment Partitioning with parted
           Manual Alignment Partitioning with parted
           Partitioning with Windows

ENG⇒中ENG⇒中
   1.0 Advanced Format Hard Drive

Once, while using a Windows 7 hard drive for work, it started making a grinding noise as if it was about to fail. To be safe, I bought a new hard drive and used Norton GHOST to copy the data from the old drive to the new one. It should have been a simple task, but it turned out to be the beginning of a nightmare.

The new hard drive was running slower than a tortoise. How could a new hard drive be as slow as the Stone Age? The sluggish PC forced me to work overtime every day just to get the job done. On top of that, I spent several days investigating the cause of the slow hard drive, depriving myself of proper sleep.

After several days of investigation, I discovered that most of the hard drives currently available are "Advanced Format Hard Drives" (AF). If the partitions are not aligned with the physical sectors of the advanced format hard drive, it severely affects the performance of the hard drive. Windows encounters partition alignment issues with advanced format hard drives, and the same goes for Linux.

"Advanced Format Hard Drives" can increase the capacity of the hard drive by approximately 10% without increasing hardware costs, thanks to the same disk density. Some hard drive manufacturers began experimentally introducing advanced format hard drives in 2011. Since 2014, most hard drives available for purchase should be advanced format hard drives (as for SSDs, based on my testing of several SSDs I have, some are Advanced Format, some are not, so whether an SSD is Advanced Format doesn't seem to have much impact on cost).

Although advanced format hard drives have capacity advantages, improper partitioning without understanding the implications can significantly affect the speed of the hard drive. Before understanding advanced format hard drives, it's essential to understand traditional format hard drives.

In a traditional format hard drive, a sector consists of approximately 512 bytes plus around 50 bytes of error correcting code (ECC) as shown in the diagram below.
hd 512k sector
Pay attention to traditional format hard drives, and you'll notice that approximately 8% of a 512-byte sector is wasted on ECC. This led some people to think about increasing the sector size while still making the increase in ECC limited to better utilize disk space effectively.

In advanced format hard drives, the sector size is no longer limited to 512 bytes. Instead, advanced formats define 1K/2K and 4K sector sizes. However, the three major mainstream file systems, such as Linux's ext3/ext4, Windows' NTFS, and Apple's HFS Plus, default to using 4K for a cluster or block. Therefore, if a sector is also 4K, it can fill up completely and be more efficient. As a result, advanced format hard drives have evolved to use only 4K sectors.

Taking a 4K (4096-byte) sector advanced format hard drive as an example, the diagram below illustrates that a sector consists of 4K plus an additional 100 bytes of ECC. Just by looking at it, you can see that it can effectively utilize space better than a traditional 512-byte sector hard drive.
adf hd 4k sector

^ back on top ^


   1.1 Partitioning Advanced Format Hard Drive
:Partitioning advanced formatted hard drives involves aligning the starting sector of partitions with the 4k Physical Sector of the hard drive, especially for 512e drives. Improper partitioning not only affects speed but can also lead to premature disk failure.

Linux parted provides better support for partitioning advanced formatted hard drives compared to fdisk. However, Linux Kernel versions older than v2.6.31 cannot recognize advanced formatted hard drives. If the Linux Kernel version is 2.6.31 or newer and the parted version is 2.1 or newer, it can correctly identify advanced formatted hard drives and automatically align partitions.


To identify the Linux Kernel and parted versions, you can use the following commands:
# uname -r ←to identify the Kernel version
# parted -v ←to identify the parted version

Common tools and versions that automatically align advanced formatted hard drives are as follows:
Kernel ≧2.6.31
partition parted ≧2.1
RAID mdadm ≧2.15
LVM lvm2 ≧2.15

Windows XP and earlier versions, as well as older Linux distributions with a kernel version below 2.6.31, cannot automatically align partitions with advanced formatted hard drives. If users are using these outdated operating systems and experiencing slow disk performance, they should thoroughly check their partition alignent.

The solution is to use a Linux version that supports advanced formatted hard drives and utilize the automatic alignment feature in parted, or manually align partitions using parted. Alternatively, users can use Windows Vista or a later version to partition the drive and then install the older operating systems.




^ back on top ^




[Note1.0] Reference source: http://support.microsoft.com/kb/2510009

[Note1.1] Refer to Red Hat’s explanation of parted automatic alignment: http://people.redhat.com/msnitzer/docs/io-limits.txt

[Note1.1a] Reference source: Vista’s New Partitioning Rules: http://www.multibooters.co.uk/partitions.html