dereenigne.org

reverse engineered

4k Drive Alignment

With 4k advanced format drives becoming more and more popular, it is important that users understand the differences that the move from a 512 to 4k sector size brings about.

During this transitional phase, the majority of larger drives are using 4k sectors internally, but exposing a 512 byte section externally for compatibility reasons.

See for yourself using fdisk. Below is the output of a Samsung HD204UI 2 TB drive:

root@alpha:/etc# fdisk -l /dev/sdb

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
218 heads, 56 sectors/track, 320038 cylinders
Units = cylinders of 12208 * 512 = 6250496 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      320039  1953513560   fd  Linux raid autodetect

While these drives will work out of the box, unless the drive is aligned to a 4k sector boundary, each read/write action will require multiple sector to be read and rewritten. Not very efficient at all.

The following arguments will set up fdisk to create properly aligned partitions on /dev/sdb:

fdisk -c -u -H 224 -S 56 /dev/sdb

comments powered by Disqus