HDPARM(8) System Manager’s Manual HDPARM(8)
NAME hdparm - get/set SATA/IDE device parameters
SYNOPSIS hdparm [options] [device . . . ]
DESCRIPTION hdparm provides a command line interface to various kernel
interfaces supported by the Linux SATA/PATA/SAS “libata” subsystem and the
older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures
now also support “SAT” (SCSI-ATA Command Translation) and therefore may
also work with hdparm. E.g. recent WD “Passport” models and recent NexStar-3
enclosures. Some options may work correctly only with the latest kernels.
OPTIONS When no options are given, -acdgkmur is assumed. For “Get/set”
options, a query without the optional parameter (e.g. -d) will query (get) the
device state, and with a parameter (e.g., -d0) will set the device state.
   -a      Get/set sector count for filesystem (software) read-ahead. This is used to improv
           Many IDE drives also have a separate built-in read-ahead function, which augments
   -A      Get/set the IDE drive´s read-lookahead feature (usually ON by default).   Usage: -A
   -b      Get/set bus state.
   -B      Get/set Advanced Power Management feature, if the drive supports it. A low value
           spin-down), and values 128 through 254 (which do not permit spin-down). The highe
           hdparm to disable Advanced Power Management altogether on the drive (not all drive
   -c      Get/set (E)IDE 32-bit I/O support. A numeric parameter can be used to enable/di
           able 32-bit data transfers with a special sync sequence required by many chipsets.
           across a PCI or VLB bus to the interface card only; all (E)IDE drives still have o
   -C      Check the current IDE power mode status, which will always be one of unknown (
           mode, drive is completely shut down). The -S, -y, -Y, and -Z options can be used
   -d      Get/set the "using_dma" flag for this drive. This option now works with most comb
           propriate -X option in combination with -d1 to ensure that the drive itself is
           mance, with fast I/O throughput and low CPU usage. But there are at least a few c
           ware!). Your mileage may vary.
   --dco-freeze
          DCO stands for Device Configuration Overlay, a way for vendors to selectively disa
          malware) from changing any DCO settings until after the next power-on reset.
   --dco-identify
          Query and dump information regarding drive configuration settings which can be di
          patibility". When disabled, they are otherwise hidden and will not show in the -I
          with a specific BIOS. In such cases, --dco-identify will show that the drive is 4
                                      1
--dco-restore
       Reset all drive settings, features, and accessible capacities back to factory def
       EXTREMELY DANGEROUS and will very likely cause massive loss of data. DO NOT USE T
--direct
       Use the kernel´s "O_DIRECT" flag when performing a -t timing test. This bypasses
       produce results that appear much faster than the usual page cache method, giving a
--drq-hsm-error
       VERY DANGEROUS, DON'T EVEN THINK ABOUT USING IT. This option causes hdparm to i
       Qust(DRQ) line "stuck" high. This confuses the kernel drivers, and may crash the
       malfunctions. VERY DANGEROUS, DO NOT USE!!
-D    Enable/disable the on-drive defect management feature, whereby the drive firmware
      ture via the -D option is not supported for most modern drives since ATA-4; thus t
-E    Set cd/dvd drive speed. This is NOT necessary for regular operation, as the drive
      like 2 or 4. This can be useful in some cases, though, to smooth out DVD video pl
-f    Sync and flush the buffer cache for the device on exit.   This operation is also pe
--fallocate
       This option currently works only on ext4 and xfs filesystem types. When used,
       the pathname for the new file. It will create a new file of the specified size, b
       E.g. Create a 10KByte file: hdparm --fallocate 10 temp_file
--fibmap
       When used, this must be the only option given. It requires a file path as a param
       numbers, referenced from sector 0 of the physical device rather than from the
       files, or determining appropriate sectors to deliberately corrupt during fault-inj
       This option uses the new FIEMAP (file extent map) ioctl() when available, and fall
       work beyond 8TB or 16TB. FIBMAP is also very slow, and does not deal well with pr
--fwdownload
       When used, this should be the only option given. It requires a file path immedia
       the (S)ATA DOWNLOAD MICROCODE command, using either transfer protocol 7 (entire fi
       both the drive and all data on it. DO NOT USE THIS COMMAND. The --fwdownload-mo
       of forcing hdparm to use a specific transfer protocol, for testing purposes only.
-F    Flush the on-drive write cache buffer (older drives may not implement this).
-g    Display the drive geometry (cylinders, heads, sectors), the size (in sectors) of t
                             2
-h    Display terse usage information (help).
-H    Read the temperature from some (mostly Hitachi) drives.      Also reports if the tempe
-i    Display the identification info which the kernel drivers (IDE, libata) have stored
      The data returned may or may not be current, depending on activity since booting
      working draft, revision 4a, April 19/93, and later editions.
--idle-immediate
       Issue an ATA IDLE_IMMEDIATE command, to put the drive into a lower power state.     U
--idle-unload
       Issue an ATA IDLE_IMMEDIATE_WITH_UNLOAD command, to unload or park the heads and p
-I    Request identification info directly from the drive, which is displayed in a new e
--Iraw <pathname>
       This option dumps the drive's identify data in raw binary to the specified file.
--Istdin
       This is a special variation on the -I option, which accepts a drive identification
       /proc/ide/*/hd*/identify "files", or that produced by the --Istdout option desc
       drives which may give media errors with the standard mechanism. When --Istdin is
       --Istdin is used.
--Istdout
       This option dumps the drive's identify data in hex to stdout, in a format similar
-J    Get/set the Western Digital (WD) Green Drive's "idle3" timeout value. This timeou
      very poor choice for use with Linux. Leaving it at the default will result in hu
      cles, so leaving it at the default could result in premature failure, not to menti
       WD supply a WDIDLE3.EXE DOS utility for tweaking this setting, and you should use
       cial program, even though it does seem to work on at a least a few drives. A full
       A setting of 30 seconds is recommended for Linux use.     Permitted values are from 8
       RECOMMENDED!).
-k    Get/set the "keep_settings_over_reset" flag for the drive. When this flag is se
      prevent drive reset loops which could be caused by combinations of -dmu settings.
      settings. In practice, all that is typically necessary to test a configuration (p
      in /var/log/messages on most systems).
-K    Set the drive´s "keep_features_over_reset" flag.      Setting this enables the drive t
-L    Set   the   drive´s   doorlock   flag.   Setting this to 1 will lock the door mechanism
                               3
       door locking mechanism automatically, depending on drive usage (locked whenever a
       is left mounted (read-only) after shutdown. So, by using this command to unlock t
-m    Get/set sector count for multiple sector I/O on the drive. A setting of 0 disable
      sectors per I/O interrupt, rather than the usual one sector per interrupt. Whe
      data throughput of anywhere from 5% to 50%. Some drives, however (most notably th
      8, or 16 (sectors). Larger settings may also be possible, depending on the drive.
      (32kB) drive buffers and non-optimized buffering algorithms. The -i option can be
      mode, but lose data at some settings. Under rare circumstances, such failures can
--make-bad-sector
       Deliberately create a bad sector (aka. "media error") on the disk. EXCEPTIONALLY
       (base10) parameter after the option. Depending on the device, hdparm will choos
       Some very recent drives (2008) may support the new WRITE_UNCORRECTABLE_EXT command
       self presents a choice of how the new bad sector should behave. By default, it wi
       letter f is prepended immediately in front of the first digit of the sector numb
       genuinely corrupt it), and subsequent READs of the sector will fail immediately (r
       needed, including sectors that were genuinely bad (the drive will likely remap tho
-M    Get/set Automatic Acoustic Management (AAM) setting. Most modern harddisk drives h
      quiet (and therefore slowest) setting and 254 the fastest (and loudest). Some driv
      options, off, quiet, and fast. These have been assigned the values 0, 128, and 25
-n    Get or set the "ignore_write_errors" flag in the driver.   Do NOT play with this wi
-N    Get/set max visible number of sectors, also known as the Host Protected Area set
      and the second shows the native (real) hardware limit for the disk. The differenc
      tected Area (HPA). This area is often used by computer makers to hold diagnostic
      of a very large disk from a BIOS/system that cannot normally cope with drives of t
      as a 2TB drive). To change the current max (VERY DANGEROUS, DATA LOSS IS EXTREMEL
      rather than the "max sector address" of the drive. Drives have the concept of a
      and power cycles. By default, -N affects only the temporary (volatile) setting.
      posed to allow only a single permanent change per session. A hardware reset (o
      being accessed by other software at the same time. This is because setting the va
      kernel.   So if it fails initially, just try again. Kernel support for -N is bugg
      kernel, this does finally seem to be working on most hardware.
--offset
       Offsets to given number of GiB (1024*1024*1024) when performing -t timings of devi
       drives (SSDs) should show similar timings regardless of offset.
-p    Attempt to reprogram the IDE interface chipset for the specified PIO mode, or atte
      even then the support is iffy at best. Some IDE chipsets are unable to alter
      fewer or more than the standard six (0 to 5) PIO modes, so the exact speed setting
      for the unwary, and an unsuccessful outcome may result in severe filesystem corrup
                             4
-P    Set the maximum sector count for the drive´s internal prefetch mechanism.    Not all
--prefer-ata12
       When using the SAT (SCSI ATA Translation) protocol, hdparm normally prefers to us
       used to force use of the smaller 12-byte command format with such drives. hdparm
-q    Handle the next option quietly, suppressing normal output (but not error messages)
-Q    Get or set the device's command queue_depth, if supported by the hardware.   This o
      disks, this is the Native Command Queuing (NCQ) queue depth.
-r    Get/set read-only flag for the device.   When set, Linux disallows write operations
-R    Get/set Write-Read-Verify feature, if the drive supports it. Usage: -R0 (disable)
      that the data was successfully written. This is generally overkill, and can slow
--read-sector
       Reads from the specified sector number, and dumps the contents in hex to standard
       layer read/write mechanisms) for the specified sector. This can be used to defini
--repair-sector
       This is an alias for the --write-sector option.   VERY DANGEROUS.
-s    Enable/disable the power-on in standby feature, if supported by the drive. V
      2.6.22) support probing for drives that use this feature. When enabled, the drive
      when many drives share a power supply. Primarily for use in large RAID setups. T
      feature by a jumper. Some SATA drives support the control of this feature by pin
-S    Put the drive into idle (low-power) mode, and also set the standby (spindown) time
      dle motor to save power. Under such circumstances, the drive may take as long a
      liar. A value of zero means "timeouts are disabled": the device will not automati
      241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30
      hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 se
--set-sector-size
       For drives which support reconfiguring of the Logical Sector Size, this flag can b
       size must be one of 512, 520, 528, 4096, 4160, or 4224. Very few drives support v
-t    Perform timings of device reads for benchmark and comparison purposes. For mean
      of megabytes of free memory. This displays the speed of reading through the buffe
      reads under Linux, without any filesystem overhead. To ensure accurate measuremen
-T    Perform timings of cache reads for benchmark and comparison purposes. For meaning
      megabytes of free memory. This displays the speed of reading directly from the L
      the system under test.
                             5
--trim-sector-ranges
       For Solid State Drives (SSDs). EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!!
       tors available for immediate use by the firmware's garbage collection mechanism, t
       an LBA starting address, a colon, and a sector count (max 65535), with no interven
       E.g.   hdparm --trim-sector-ranges 1000:4 7894:16 /dev/sdz
--trim-sector-ranges-stdin
       Identical to --trim-sector-ranges above, except the list of lba:count pairs is
       also permits batching of many more sector ranges into single commands to the drive
-u    Get/set the interrupt-unmask flag for the drive. A setting of 1 permits the drive
      overrun" errors. Use this feature with caution: some drive/controller combinatio
      lar, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable (due to a hardware fl
      BIOS/CMOS setting) provides a safe fix for the problem for use with earlier kernel
-v    Display some basic settings, similar to -acdgkmur for IDE.    This is also the defau
-V    Display program version and exit immediately.
--verbose
       Display extra diagnostics from some commands.
-w    Perform a device reset (DANGEROUS).   Do NOT use this option.   It exists for unlike
--write-sector
       Writes zeros to the specified sector number. VERY DANGEROUS. The sector numbe
       nisms) to the specified sector. This can be used to force a drive to repair a bad
-W    Get/set the IDE/SATA drive´s write-caching feature.
-X    Set the IDE transfer mode for (E)IDE/ATA drives. This is typically used in combin
      fers and -X sdma1 is used to select simple mode 1 DMA transfers. With systems whi
      forehand).   Apart from that, use of this option is seldom necessary since mos
      which support alternate transfer modes, -X can be used to switch the mode of the d
      to prevent loss and/or corruption of data. Use this with extreme caution! For
      sets PIO mode1, 10 enables PIO mode2, and 11 selects PIO mode3. Setting 00 restor
      traDMA, the value is the desired UltraDMA mode number plus 64.
-y    Force an IDE drive to immediately enter the low power consumption standby mode, us
-Y    Force an IDE drive to immediately enter the lowest power consumption sleep mode,
      matically handle issuing a reset if/when needed). The current power mode status c
-z    Force a kernel re-read of the partition table of the specified device(s).
                              6
-Z    Disable the automatic power-saving function of certain Seagate drives (ST3xxx mode
ATA Security Feature Set
These switches are DANGEROUS to experiment with, and might not work with some kernels.    U
--security-help
       Display terse usage info for all of the --security-* options.
--security-freeze
       Freeze the drive´s security settings. The drive does not accept any security comm
       word. Can be used standalone, too. No other options are permitted on the command
--security-prompt-for-password
       Prompt for the --security PWD rather than getting from the command line args.     Thi
--security-unlock PWD
       Unlock the drive, using password PWD. Password is given as an ASCII string and
       No other options are permitted on the command line with this one.
--security-set-pass PWD
       Lock the drive, using password PWD (Set Password) (DANGEROUS). Password is given
       password is selected with the --user-master switch (default is "user" password) an
--security-disable PWD
       Disable drive locking, using password PWD. Password is given as an ASCII strin
       word). No other options are permitted on the command line with this one.
--security-erase PWD
       Erase (locked) drive, using password PWD (DANGEROUS). Password is given as an ASC
       password is selected with the --user-master switch (default is "user" password).
--security-erase-enhanced PWD
       Enhanced erase (locked) drive, using password PWD (DANGEROUS). Password is giv
       fault is "user" password). No other options are permitted on the command line wit
--user-master USER
       Specifies which password (user/master) to select.   Defaults to user password.    Onl
               u       user password
               m       master password
--security-mode MODE
       Specifies which security mode (high/maximum) to set.   Defaults to high.   Only usef
               h       high security
               m       maximum security
                             7
            THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.
FILES /etc/hdparm.conf
BUGS As noted above, the -m sectcount and -u 1 options should be used with
caution at first, preferably on a read-only filesystem. Most drives work well with
these features, but a few drive/controller combinations are not 100% compati-
ble. Filesystem corruption may result. Backup everything before experimenting!
   Some options (e.g. -r for SCSI) may not work with old kernels as necessary ioctl()´s were
   Although this utility is intended primarily for use with SATA/IDE hard disk devices, seve
   The Linux kernel up until 2.6.12 (and probably later) doesn´t handle the security unlock
   by the drive. This poor kernel behaviour makes the PIO data security commands rather usel
   Note that the "security erase" and "security disable" commands have been implemented as t
   the code for hints how patch it to work around this problem. Despite the segfault it is o
AUTHOR hdparm has been written by Mark Lord mlord@pobox.com, the
original primary developer and maintainer of the (E)IDE driver for Linux, and
current contributor to the libata subsystem, along with suggestions and patches
from many netfolk.
   The disable Seagate auto-powersaving code is courtesy of Tomi Leppikangas(tomilepp@paju.o
   Security freeze command by Benjamin Benz, 2005.
   PIO data out security commands by Leonard den Ottolander, 2005.                   Some other parts by Benj
SEE ALSO http://www.t13.org/ Technical Committee T13 AT Attachment
(ATA/ATAPI) Interface.
   http://www.serialata.org/ Serial ATA International Organization.
   http://www.compactflash.org/ CompactFlash Association.
Version 9.65 Sep 2022 HDPARM(8)