Difference between revisions of "Advanced Format"

From ArchWiki
Jump to: navigation, search
(Current HDD Models that Employ a 4k Sectors: it's 2017 now, not a problem anymore)
(Special Consideration for WD Green HDDs: running hdparm -J repeatedly makes no sense (all three tools modify the firmware), --please-destroy-my-drive is not explained and hdparm likely prints what it needs, idle3ctl has its own documentation)
Line 44: Line 44:
 
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}}.
 
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}}.
  
==Special Consideration for WD Green HDDs==
+
== Power management 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! To see if you are affected use the smartctl command (part of smartmontools). If the last column changes rapidly, this section applies to your drive.  
+
The the Western Digital Green drives have a special "idle3" timeout, which controls how often the drive parks its heads and enters a low power consumption state. The factory default is 8 seconds, which is a very poor choice for use with Linux. Leaving it at the default will result in hundreds of thousands of head load/unload cycles in a very short period of time, which could result in premature failure, not to mention the performance impact of the drive often having to wake-up before doing routine I/O.
# smartctl /dev/sdb -a | grep Load_Cycle
 
193 Load_Cycle_Count        0x0032  001  001  000    Old_age  Always      -      597115
 
  
=== Disable via hdparm ===
+
WD supplies an official {{ic|WDIDLE3.EXE}} DOS utility for tweaking this setting, which should be used if at all possible. [[hdparm]] features a reverse-engineered implementation behind the {{ic|-J}} flag, which is not as complete as the original official program, even though it seems to work on at a least a few drives. Another unofficial utility is provided by the {{Pkg|idle3-tools}} package. A full power cycle is required for any change in setting to take effect, regardless of which program is used to tweak things.
Use hdparm in {{ic|/etc/systemd/system/lcc_fix.service}} to disable this 'feature' and likely add life to your hdd:
 
 
 
{{hc|/etc/systemd/system/lcc_fix.service |<nowiki>
 
[Unit]
 
Description=WDIDLE3
 
 
 
[Service]
 
Type=oneshot
 
ExecStart=/usr/bin/hdparm -J 300 --please-destroy-my-drive /dev/sdX
 
TimeoutSec=0
 
StandardInput=tty
 
RemainAfterExit=yes
 
 
 
[Install]
 
WantedBy=multi-user.target
 
</nowiki>}}
 
 
 
Start the service
 
# systemctl start lcc_fix.service
 
 
 
Enable the service to autorun at boot.
 
# systemctl enable lcc_fix.service
 
 
 
==== Is this safe? ====
 
Why do we need to pass the "--please-destroy-my-drive" flag?  Here is an email from hdparm author, Mark Lord:
 
 
 
> I have a Western DIgital \"Green\" drive (wd20ears).  I noticed you added a -J switch and that
 
> it is said to adjust the idle3 timeout.  What frightens me is the output you gave it:
 
>
 
> How safe or not is this to use?
 
 
I use it on my own drives.  It works for me.
 
 
If you can run the WDIDLE3.EXE MS-Dos program,
 
then use it instead -- it was written by WD,
 
and only they know how things really work there.
 
 
If you cannot use the WDIDLE3.EXE, then you
 
could consider "hdparm -J".  It works for me,
 
but it may or may not void some kind of warranty.
 
 
Cheers
 
--
 
Mark Lord
 
Real-Time Remedies Inc.
 
mlord@pobox.com
 
 
 
=== Disable via changing firmware value (persistent) ===
 
 
 
{{Warning|The tool used in this process is experimental, use at your own risk!}}
 
 
 
{{Note|This method is persistent, you only need to do this once for every drive.}}
 
 
 
This method will use a utility called idle3ctl to alter the firmware value for the idle3 timer on WD hard drives (similar to wdidle3.exe from WD). The advantage compared to the official utility is you do not need to create a DOS bootdisk first to change the idle3 timer value. Additionally idle3ctl might also work over USB-to-S-ATA bridges (in some cases).
 
The utility is provided by the {{Pkg|idle3-tools}} package.
 
 
 
# idle3ctl -g /dev/your_wd_hdd
 
 
 
to get the raw idle3 timer value.
 
You can disable the IntelliPark feature completely, with:
 
 
 
# idle3ctl -d /dev/your_wd_hdd
 
 
 
or set it to a different value (''0''-''255'') with (e.g. 10 seconds):
 
 
 
# idle3ctl -s 100 /dev/your_wd_hd
 
 
 
The range ''0''-''128'' is in 0.1s and ''129-255'' in 30s. For the changes to take effect, the drive needs to go through one powercycle, meaning powering it off and on again (on internal drives, a reboot is not sufficient).
 
 
 
If your WD hard drive is not recognized, you can use the ''--force'' option. For more options see:
 
 
 
$ idle3ctl -h
 
  
 
== See also ==
 
== See also ==

Revision as of 16:10, 3 June 2017

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Partially overlaps with Partitioning#Partition alignment, these pages are not very well interlinked. (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].

Power management for WD Green HDDs

The the Western Digital Green drives have a special "idle3" timeout, which controls how often the drive parks its heads and enters a low power consumption state. The factory default is 8 seconds, which is a very poor choice for use with Linux. Leaving it at the default will result in hundreds of thousands of head load/unload cycles in a very short period of time, which could result in premature failure, not to mention the performance impact of the drive often having to wake-up before doing routine I/O.

WD supplies an official WDIDLE3.EXE DOS utility for tweaking this setting, which should be used if at all possible. hdparm features a reverse-engineered implementation behind the -J flag, which is not as complete as the original official program, even though it seems to work on at a least a few drives. Another unofficial utility is provided by the idle3-tools package. A full power cycle is required for any change in setting to take effect, regardless of which program is used to tweak things.

See also