Difference between revisions of "Advanced Format"

From ArchWiki
Jump to: navigation, search
m (Current HDD Models that Employ a 4k Sectors: Added my Samsung drive which is Advanced Format)
m (added interlanguage link)
(85 intermediate revisions by 53 users not shown)
Line 1: Line 1:
[[Category:Storage (English)]]
+
[[Category:Storage]]
==Introduction==
+
[[ja:Advanced Format]]
The 'advanced format' feature reduces overhead by using 4 kilobyte sectors instead of the traditional 512 byte sectors. The old format gave a format efficiency of 87%. Advanced Format results in a format efficiency of 96% which increases space by up to 11%.  The 4k sector is slated to become the next standard for HDDs by 2014.
+
[[ru:Advanced Format]]
 +
{{Merge|Partitioning#Partition alignment|Wikipedia has much better general description, alignment can be described on the [[Partitioning]] page.}}
  
===More Detailed Explanation===
+
The [[wikipedia:Advanced Format|Advanced Format]] is a generic term pertaining to any disk sector format used to store data on magnetic disks in [[w:hard disk drives|hard disk drives]] (HDDs) that uses 4 kilobyte sectors instead of the traditional 512 byte sectors. The main idea behind using 4096-byte sectors is to increase the bit density on each track by reducing the number of gaps which hold Sync/DAM and ECC (Error Correction Code) information between data sectors. The old format gave a format efficiency of 88.7%, whereas Advanced Format results in a format efficiency of 97.3%.
512-byte sector size standard is here for over 30 years and therefore lots of the code written for a Linux OS has 512 number hard coded in its source. The main idea in regards to the 4096 B size sectors is to increase the bit density on each track by reducing the number of gaps which hold Sync/DAM and ECC ( Error Correction Code ) information between each data sectors. Therefore, for 8 x 512 B sectors the track also holds 8 sector gaps.
 
  
By having one single sector of size 4096 B (8 x 512 B) the track holds only 1 sector gap for each data sector thus reducing an overhead for a need to support multiple Sync/DAM and ECC blocks and at the same time increasing bit density.
+
== How to determine if HDD employ a 4k sector ==
  
Linux partitioning tools by default start each partition on sector 63 which leads to a bad performance in HDDs that use this 4k sector size due to misalignment to 4K sector from the beginning of the track.
+
The physical and logical sector size of hard disk /dev/sd''X'' can be determined by reading the following sysfs entries:
 +
$ cat /sys/class/block/sd''X''/queue/physical_block_size
 +
$ cat /sys/class/block/sd''X''/queue/logical_block_size
  
===External Links===
+
Tools which will report the physical sector of a drive (provided the drive will report it correctly) includes
*[http://www.anandtech.com/Show/Index/2888?cPage=2&all=False&sort=0&page=1 Western Digital’s Advanced Format: The 4K Sector Transition Begins]
+
* smartmontools (since 5.41 ; <tt>smartmontools -a</tt>, in information section)
*[http://www.wdc.com/wdproducts/library/WhitePapers/ENG/2579-771430.pdf White paper entitled "Advanced Format Technology."]
+
* hdparm (since 9.12 ; <tt>hdparm -I</tt>, in configuration section)
*Failure to align one's HDD results in poor read/write performance.  See [http://www.linuxconfig.org/linux-wd-ears-advanced-format this article] for specific examples.
 
  
==Current HDD Models that Employ a 4k Sectors==
+
Note that both works even for USB-attached discs (if the USB bridge supports SAT aka SCSI/ATA Translation, ANSI INCITS 431-2007).
As of July/2010, there are a limited number of HDDs that support "Advanced Format" or 4k sectors as shown below:
 
  
{| border="1" cellpadding="5"
+
==Aligning Partitions==
! Manufacturer !! Model !! Capacity
 
|-
 
| 3.5"
 
|
 
|
 
| Western Digital
 
| WD30EZRSDTL
 
| 3.0 TB
 
|-
 
| Western Digital
 
| WD25EZRSDTL
 
| 2.5 TB
 
|-
 
| Samsung
 
| HD204UI
 
| 2.0TB
 
|-
 
| Western Digital
 
| WD20EARS
 
| 2.0 TB
 
|-
 
| Western Digital
 
| WD15EARS
 
| 1.5 TB
 
|-
 
| Western Digital
 
| WD10EARS/WD10EURS
 
| 1.0 TB
 
|-
 
| Western Digital
 
| WD8000AARS
 
| 800.0 GB
 
|-
 
| Western Digital
 
| WD6400AARS
 
| 640.0 GB
 
|-
 
| 2.5"
 
|
 
|
 
|-
 
| Western Digital
 
| WD10TPVT
 
| 1.0 TB
 
|-
 
| Western Digital
 
| WD7500BPVT/WD7500KPVT
 
| 750.0 GB
 
|-
 
| Western Digital
 
| WD6400BPVT
 
| 640.0 GB
 
|-
 
| Western Digital
 
| WD5000BPVT
 
| 500.0 GB
 
|-
 
| Western Digital
 
| WD3200BPVT
 
| 320.0 GB
 
|-
 
| Western Digital
 
| WD2500BPVT
 
| 250.0 GB
 
|-
 
| Western Digital
 
| WD1600BPVT
 
| 160.0 GB
 
|}
 
  
{{Note| Readers are encouraged to add to this table.}}
+
{{Note|This should no longer require manual intervention. Any tools using recent libblkid versions are capable of handling Advanced Format automatically.}}
  
==Aligning Partitions==
+
Versions with this support include:
===Check your partitions alignement===
+
 
 +
* fdisk, since util-linux >= 2.15. You should start with ‘-c -u’ to disable DOS compatibility and use sectors instead of cylinders.
 +
* parted, since parted >= 2.1.
 +
* mdadm, since util-linux >= 2.15
 +
* lvm2, since util-linux >= 2.15
 +
* mkfs.{ext,xfs,gfs2,ocfs2} all support libblkid directly.
 +
 
 +
Refer to [https://www.tolaris.com/2011/07/21/libblkid-or-why-you-dont-need-to-worry-about-4k-disk-format/ this page] for further information.
 +
 
 +
===Check your partitions alignment===
 +
{{Note|This only works with [[MBR]], not [[GPT]].}}
 
  # fdisk -lu /dev/sda
 
  # fdisk -lu /dev/sda
 
  ...
 
  ...
Line 102: Line 43:
  
 
===GPT (Recommended)===
 
===GPT (Recommended)===
When using [[GPT]] partition tables, one need only use gdisk to create partitions which are aligned by default.  For an example, see [[SSD#Detailed_Usage_Example]].
+
When using [[GPT]] partition tables, one need only use gdisk to create partitions which are aligned by default.  For an example, see [[SSD#Detailed Usage Example]]{{Broken section link}}.
 
 
===MBR (Not Recommended)===
 
One can employ fdisk to align partitions to sector 2048 which will ensure that the partitions are aligned to the 4k sector.  Interestingly, in sector mode, the default starting point is not 63 or 64 but 2048 in the current version of fdisk (2.17.2) so it's automatically taking care of the 4k sector size!
 
 
 
# fdisk -c -u /dev/sda
 
 
 
==Special Consideration for WD Green HDDs==
 
 
 
FYI - this section has nothing to do with Advanced Format technology, but this is an appropriate location to share it with users.  The WD20EARS (and other sizes include 1.0 and 1.5 TB driver in the series) will attempt to park the read heads once every 8 seconds FOR THE LIFE OF THE HDD which is just horrible!  Use hdparm in {{Filename|/etc/rc.local}} to disable this 'feature' and likely add life to your hdd:
 
  
# echo "hdparm -S 242 /dev/sdX" > /etc/rc.local
+
== See also ==
  
Alternatively, the following bash script can accomplish this automatically:
+
* [http://www.anandtech.com/Show/Index/2888 Western Digital’s Advanced Format: The 4K Sector Transition Begins]
#!/bin/bash
+
* [http://www.wdc.com/wdproducts/library/WhitePapers/ENG/2579-771430.pdf White paper entitled "Advanced Format Technology."]
  for DISK in `fdisk -l |grep [12]000.4 | cut -c13-13`
+
* Failure to align one's HDD results in poor read/write performance. See [http://www.linuxconfig.org/linux-wd-ears-advanced-format this article] for specific examples.
do echo hdparm -S 242 /dev/sd$DISK
 
done
 

Revision as of 14:04, 22 July 2017

Merge-arrows-2.pngThis article or section is a candidate for merging with Partitioning#Partition alignment.Merge-arrows-2.png

Notes: Wikipedia has much better general description, alignment can be described on the Partitioning page. (Discuss in Talk:Advanced Format#)

The Advanced Format is a generic term pertaining to any disk sector format used to store data on magnetic disks in hard disk drives (HDDs) that uses 4 kilobyte sectors instead of the traditional 512 byte sectors. The main idea behind using 4096-byte sectors is to increase the bit density on each track by reducing the number of gaps which hold Sync/DAM and ECC (Error Correction Code) information between data sectors. The old format gave a format efficiency of 88.7%, whereas Advanced Format results in a format efficiency of 97.3%.

How to determine if HDD employ a 4k sector

The physical and logical sector size of hard disk /dev/sdX can be determined by reading the following sysfs entries:

$ cat /sys/class/block/sdX/queue/physical_block_size
$ cat /sys/class/block/sdX/queue/logical_block_size

Tools which will report the physical sector of a drive (provided the drive will report it correctly) includes

  • smartmontools (since 5.41 ; smartmontools -a, in information section)
  • hdparm (since 9.12 ; hdparm -I, in configuration section)

Note that both works even for USB-attached discs (if the USB bridge supports SAT aka SCSI/ATA Translation, ANSI INCITS 431-2007).

Aligning Partitions

Note: This should no longer require manual intervention. Any tools using recent libblkid versions are capable of handling Advanced Format automatically.

Versions with this support include:

  • fdisk, since util-linux >= 2.15. You should start with ‘-c -u’ to disable DOS compatibility and use sectors instead of cylinders.
  • parted, since parted >= 2.1.
  • mdadm, since util-linux >= 2.15
  • lvm2, since util-linux >= 2.15
  • mkfs.{ext,xfs,gfs2,ocfs2} all support libblkid directly.

Refer to this page for further information.

Check your partitions alignment

Note: This only works with MBR, not GPT.
# fdisk -lu /dev/sda
...
# Device     Boot      Start   End         Blocks      Id System
# /dev/sda1            2048    46876671    23437312    7  HPFS/NTFS

2048 (default since fdisk 2.17.2) means that your HDD is aligned correctly. Any other value divisible by 8 is good as well.

GPT (Recommended)

When using GPT partition tables, one need only use gdisk to create partitions which are aligned by default. For an example, see SSD#Detailed Usage Example[broken link: invalid section].

See also