{
    "mode": "man",
    "parameter": "HDPARM",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/HDPARM/8/json",
    "generated": "2026-09-11T15:26:10Z",
    "synopsis": "hdparm [options] [device ...]",
    "sections": {
        "NAME": {
            "content": "hdparm - get/set SATA/IDE device parameters\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "hdparm [options] [device ...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "hdparm  provides a command line interface to various kernel interfaces supported by the Linux\nSATA/PATA/SAS \"libata\" subsystem and the older IDE driver subsystem.  Many  newer  (2008  and\nlater)  USB drive enclosures now also support \"SAT\" (SCSI-ATA Command Translation) and there‐\nfore may also work with hdparm.  E.g., recent WD \"Passport\" models and recent  NexStar-3  en‐\nclosures.  Some options may work correctly only with the latest kernels.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "When  no options are given, -acdgkmur is assumed.  For \"Get/set\" options, a query without the\noptional parameter (e.g., -d) will query (get) the device state, and with a parameter  (e.g.,\n-d0) will set the device state.\n\n-a     Get/set  sector  count  for filesystem (software) read-ahead.  This is used to improve\nperformance in sequential reads of large files, by prefetching  additional  blocks  in\nanticipation  of  them  being needed by the running task.  Many IDE drives also have a\nseparate built-in read-ahead function, which augments this filesystem (software) read-\nahead function.\n\n-A     Get/set the IDE drive's read-lookahead feature (usually ON by  default).   Usage:  -A0\n(disable) or -A1 (enable).\n\n-b     Get/set bus state.\n\n-B     Get/set Advanced Power Management feature, if the drive supports it. A low value means\naggressive  power management and a high value means better performance.  Possible set‐\ntings range from values 1 through 127 (which permit spin-down), and values 128 through\n254 (which do not permit spin-down).  The highest degree of power  management  is  at‐\ntained  with a setting of 1, and the highest I/O performance with a setting of 254.  A\nvalue of 255 tells hdparm to disable Advanced Power Management altogether on the drive\n(not all drives support disabling it, but most do).\n\n-c     Get/set (E)IDE 32-bit I/O support.  A numeric parameter can be used to  enable/disable\n32-bit  I/O  support.  Currently supported values include 0 to disable 32-bit I/O sup‐\nport, 1 to enable 32-bit data transfers, and 3 to enable 32-bit data transfers with  a\nspecial  sync  sequence  required by many chipsets.  The value 3 works with nearly all\n32-bit IDE chipsets, but incurs slightly more overhead.  Note that \"32-bit\" refers  to\ndata  transfers  across a PCI or VLB bus to the interface card only; all (E)IDE drives\nstill have only a 16-bit connection over the ribbon cable from the interface card.\n\n-C     Check the current IDE power mode status, which will always be one  of  unknown  (drive\ndoes  not  support  this  command), active/idle (normal operation), standby (low power\nmode, drive has spun down), or sleeping (lowest power mode, drive is  completely  shut\ndown).  The -S, -y, -Y, and -Z options can be used to manipulate the IDE power modes.\n\n-d     Get/set the \"usingdma\" flag for this drive.  This option now works with most combina‐\ntions of drives and PCI interfaces which support DMA and which are known to the kernel\nIDE  driver.   It  is also a good idea to use the appropriate -X option in combination\nwith -d1 to ensure that the drive itself is programmed for the correct DMA  mode,  al‐\nthough  most BIOSs should do this for you at boot time.  Using DMA nearly always gives\nthe best performance, with fast I/O throughput and low CPU usage.  But  there  are  at\nleast  a few configurations of chipsets and drives for which DMA does not make much of\na difference, or may even slow things down (on  really  messed  up  hardware!).   Your\nmileage may vary.\n\n--dco-freeze\nDCO  stands for Device Configuration Overlay, a way for vendors to selectively disable\ncertain features of a drive.  The --dco-freeze option  will  freeze/lock  the  current\ndrive  configuration,  thereby  preventing software (or malware) from changing any DCO\nsettings until after the next power-on reset.\n\n--dco-identify\nQuery and dump information regarding drive configuration settings which  can  be  dis‐\nabled  by  the vendor or OEM installer.  These settings show capabilities of the drive\nwhich might be disabled by the vendor for \"enhanced  compatibility\".   When  disabled,\nthey  are  otherwise hidden and will not show in the -I identify output.  For example,\nsystem vendors sometimes disable 48bit addressing on large drives, for  compatibility\n(and  loss of capacity) with a specific BIOS.  In such cases, --dco-identify will show\nthat the drive is 48bit capable, but -I will not show it, and nor will the drive  ac‐\ncept 48bit commands.\n\n--dco-restore\nReset all drive settings, features, and accessible capacities back to factory defaults\nand  full  capabilities.   This command will fail if DCO is frozen/locked, or if a -Np\nmaximum size restriction has also been set.  This is EXTREMELY DANGEROUS and will very\nlikely cause massive loss of data.  DO NOT USE THIS COMMAND.\n\n--direct\nUse the kernel's \"ODIRECT\" flag when performing a -t timing test.  This bypasses  the\npage cache, causing the reads to go directly from the drive into hdparm's buffers, us‐\ning  so-called  \"raw\"  I/O.   In many cases, this can produce results that appear much\nfaster than the usual page cache method, giving a better indication of raw device  and\ndriver performance.\n\n--drq-hsm-error\nVERY  DANGEROUS,  DON'T EVEN THINK ABOUT USING IT.  This option causes hdparm to issue\nan IDENTIFY command to the kernel, but incorrectly marked  as  a  \"non-data\"  command.\nThis results in the drive being left with its DataReQust(DRQ) line \"stuck\" high.  This\nconfuses  the  kernel  drivers, and may crash the system immediately with massive data\nloss.  The option exists to help in testing and fortifying the kernel against  similar\nreal-world drive malfunctions.  VERY DANGEROUS, DO NOT USE!!\n\n-D     Enable/disable  the  on-drive  defect  management  feature, whereby the drive firmware\ntries to automatically manage defective sectors by relocating them to \"spare\"  sectors\nreserved  by  the  factory for such.  Control of this feature via the -D option is not\nsupported for most modern drives since ATA-4; thus this command may fail.\n\n-E     Set cd/dvd drive speed.  This is NOT necessary for regular  operation,  as  the  drive\nwill  automatically  switch  speeds on its own.  But if you want to play with it, just\nsupply a speed number after the option, usually a number like 2 or  4.   This  can  be\nuseful in some cases, though, to smooth out DVD video playback.\n\n-f     Sync  and  flush the buffer cache for the device on exit.  This operation is also per‐\nformed internally as part of the -t and -T timings and other options.\n\n--fallocate\nThis option currently works only on ext4 and xfs filesystem types.   When  used,  this\nmust  be  the only option given.  It requires two parameters: the desired file size in\nkibibytes (byte count divided by 1024), followed by the pathname for the new file.  It\nwill create a new file of the specified size, but without actually having to write any\ndata to the file.  This will normally complete very quickly, and without thrashing the\nstorage device.\n\nE.g., create a 10 kibibyte file: hdparm --fallocate 10 tempfile\n\n--fibmap\nWhen used, this must be the only option given.  It requires a file path as  a  parame‐\nter,  and  will print out a list of the block extents (sector ranges) occupied by that\nfile on disk.  Sector numbers are given as absolute LBA numbers, referenced from  sec‐\ntor  0  of the physical device rather than from the partition or filesystem.  This in‐\nformation can then be used for a variety of purposes, such as examining the degree  of\nfragmentation of larger files, or determining appropriate sectors to deliberately cor‐\nrupt during fault-injection testing procedures.\n\nThis  option  uses  the new FIEMAP (file extent map) ioctl() when available, and falls\nback to the older FIBMAP (file block map) ioctl() otherwise.  Note that FIBMAP suffers\nfrom a 32-bit block-number interface, and thus not work beyond 8 TB or 16 TB.   FIBMAP\nis  also  very  slow,  and does not deal well with preallocated uncommitted extents in\next4/xfs filesystems, unless a sync() is done before using this option.\n\n--fwdownload\nWhen used, this should be the only option given.  It requires a file path  immediately\nafter  the  option,  indicating where the new drive firmware should be read from.  The\ncontents of this file will be sent to the drive using the  (S)ATA  DOWNLOAD  MICROCODE\ncommand, using either transfer protocol 7 (entire file at once), or, if the drive sup‐\nports it, transfer protocol 3 (segmented download).  This command is EXTREMELY DANGER‐\nOUS  and  could  destroy  both the drive and all data on it.  DO NOT USE THIS COMMAND.\nThe --fwdownload-mode3 , --fwdownload-mode3-max , and --fwdownload-mode7 variations on\nbasic --fwdownload allow overriding automatic protocol detection in favour of  forcing\nhdparm to use a specific transfer protocol, for testing purposes only.\n\n-F     Flush the on-drive write cache buffer (older drives may not implement this).\n\n-g     Display  the  drive geometry (cylinders, heads, sectors), the size (in sectors) of the\ndevice, and the starting offset (in sectors) of the device from the beginning  of  the\ndrive.\n\n-h     Display terse usage information (help).\n\n-H     Read  the temperature from some (mostly Hitachi) drives.  Also reports if the tempera‐\nture is within operating condition range (this may not be reliable).  Does  not  cause\nthe drive to spin up if idle.\n\n-i     Display  the  identification  info  which the kernel drivers (IDE, libata) have stored\nfrom boot/configuration time.  This may differ from the current information obtainable\ndirectly from the drive itself with the -I option.  The data returned may or  may  not\nbe  current,  depending on activity since booting the system.  For a more detailed in‐\nterpretation of the identification info, refer to AT  Attachment  Interface  for  Disk\nDrives, ANSI ASC X3T9.2 working draft, revision 4a, April 19/93, and later editions.\n\n--idle-immediate\nIssue  an ATA IDLEIMMEDIATE command, to put the drive into a lower power state.  Usu‐\nally the device remains spun-up.\n\n--idle-unload\nIssue an ATA IDLEIMMEDIATEWITHUNLOAD command, to unload or park the heads  and  put\nthe drive into a lower power state.  Usually the device remains spun-up.\n\n-I     Request  identification  info directly from the drive, which is displayed in a new ex‐\npanded format with considerably more detail than with the older -i option.\n\n--Iraw <pathname>\nThis option dumps the drive's identify data in raw binary to the specified file.\n\n--Istdin\nThis is a special variation on the -I option, which  accepts  a  drive  identification\nblock  as  standard  input  instead of using a /dev/hd* parameter.  The format of this\nblock must be exactly the same as that found in the /proc/ide/*/hd*/identify  \"files\",\nor  that produced by the --Istdout option described below.  This variation is designed\nfor use with collected \"libraries\" of drive identification information, and  can  also\nbe used on ATAPI drives which may give media errors with the standard mechanism.  When\n--Istdin  is  used, it must be the *only* parameter given.  Note that some information\nwill be incomplete, as the drive LOG PAGES are unavailable when --Istdin is used.\n\n--Istdout\nThis option dumps the drive's identify data in hex to stdout, in a format  similar  to\nthat from /proc/ide/*/identify, and suitable for later use with the --Istdin option.\n\n-J     Get/set  the  Western  Digital (WD) Green Drive's \"idle3\" timeout value.  This timeout\ncontrols how often the drive parks its heads and enters a low power consumption state.\nThe factory default is eight (8) seconds, which is a very poor  choice  for  use  with\nLinux.   Leaving  it  at  the  default  will  result  in hundreds of thousands of head\nload/unload cycles in a very short period of time.  The drive mechanism is only  rated\nfor  300,000  to 1,000,000 cycles, so leaving it at the default could result in prema‐\nture failure, not to mention the performance impact of the drive often having to wake-\nup before doing routine I/O.\n\nWD supply a WDIDLE3.EXE DOS utility for tweaking this setting, and you should use that\nprogram instead of hdparm if at all possible.  The  reverse-engineered  implementation\nin  hdparm  is  not  as complete as the original official program, even though it does\nseem to work on at a least a few drives.  A full  power  cycle  is  required  for  any\nchange in setting to take effect, regardless of which program is used to tweak things.\n\nA  setting of 30 seconds is recommended for Linux use.  Permitted values are from 8 to\n12 seconds, and from 30 to 300 seconds in 30-second increments.  Specify  a  value  of\nzero (0) to disable the WD idle3 timer completely (NOT RECOMMENDED!).\n\n-k     Get/set the \"keepsettingsoverreset\" flag for the drive.  When this flag is set, the\ndrive will preserve the -dmu settings over a soft reset, (as done during the error re‐\ncovery  sequence).   This  option  defaults to off, to prevent drive reset loops which\ncould be caused by combinations of -dmu settings.  The -k option should therefore only\nbe set after one has achieved confidence in correct system operation with a chosen set\nof configuration settings.  In practice, all that is typically  necessary  to  test  a\nconfiguration (prior to using -k) is to verify that the drive can be read/written, and\nthat  no  error  logs  (kernel  messages)  are  generated  in  the  process  (look  in\n/var/log/messages on most systems).\n\n-K     Set the drive's \"keepfeaturesoverreset\" flag.  Setting this enables  the  drive  to\nretain  the  settings for -APSWXZ over a soft reset (as done during the error recovery\nsequence).  Not all drives support this feature.\n\n-L     Set the drive's doorlock flag.  Setting this to 1 will lock the door mechanism of some\nremovable hard drives (e.g., Syquest, ZIP, Jazz..), and setting it to  0  will  unlock\nthe  door  mechanism.   Normally, Linux maintains the door locking mechanism automati‐\ncally, depending on drive usage (locked whenever a filesystem  is  mounted).   But  on\nsystem  shutdown, this can be a nuisance if the root partition is on a removable disk,\nsince the root partition is left mounted (read-only) after  shutdown.   So,  by  using\nthis  command to unlock the door after the root filesystem is remounted read-only, one\ncan then remove the cartridge from the drive after shutdown.\n\n-m     Get/set sector count for multiple sector I/O on the drive.  A setting  of  0  disables\nthis  feature.  Multiple sector mode (aka IDE Block Mode), is a feature of most modern\nIDE hard drives, permitting the transfer of multiple sectors per I/O interrupt, rather\nthan the usual one sector per interrupt.  When this feature is enabled,  it  typically\nreduces  operating  system  overhead for disk I/O by 30–50%.  On many systems, it also\nprovides increased data throughput of anywhere from 5% to 50%.  Some  drives,  however\n(most  notably  the  WD Caviar series), seem to run slower with multiple mode enabled.\nYour mileage may vary.  Most drives support the minimum settings of 2,  4,  8,  or  16\n(sectors).   Larger  settings may also be possible, depending on the drive.  A setting\nof 16 or 32 seems optimal on many systems.  Western Digital recommends lower  settings\nof  4  to 8 on many of their drives, due tiny (32 KiB) drive buffers and non-optimized\nbuffering algorithms.  The -i option can be used to find the maximum setting supported\nby an installed drive (look for MaxMultSect in the output).  Some drives claim to sup‐\nport multiple mode, but lose data at some settings.  Under  rare  circumstances,  such\nfailures can result in massive filesystem corruption.\n\n--make-bad-sector\nDeliberately create a bad sector (aka. \"media error\") on the disk.  EXCEPTIONALLY DAN‐\nGEROUS.  DO NOT USE THIS OPTION!!  This can be useful for testing of device/RAID error\nrecovery mechanisms.  The sector number is given as a (base10) parameter after the op‐\ntion.  Depending on the device, hdparm will choose one of two  possible  ATA  commands\nfor  corrupting  the  sector.  The WRITELONG works on most drives, but only up to the\n28-bit sector boundary.  Some very recent drives (2008) may support the new  WRITEUN‐\nCORRECTABLEEXT  command, which works for any LBA48 sector.  If available, hdparm will\nuse that in preference to  WRITELONG.   The  WRITEUNCORRECTABLEEXT  command  itself\npresents  a  choice of how the new bad sector should behave.  By default, it will look\nlike any other bad sector, and the drive may take some time to retry and fail on  sub‐\nsequent  READs  of the sector.  However, if a single letter f is prepended immediately\nin front of the first digit of the sector number parameter, then hdparm will  issue  a\n\"flagged\" WRITEUNCORRECTABLEEXT, which causes the drive to merely flag the sector as\nbad  (rather  than genuinely corrupt it), and subsequent READs of the sector will fail\nimmediately (rather than after several retries).  Note also that  the  --repair-sector\noption  can  be  used to restore (any) bad sectors when they are no longer needed, in‐\ncluding sectors that were genuinely bad (the drive will likely remap those to a  fresh\narea on the media).\n\n-M     Get/set  Automatic Acoustic Management (AAM) setting. Most modern harddisk drives have\nthe ability to speed down the head movements to reduce their noise output.  The possi‐\nble values are between 0 and 254. 128 is the most quiet (and therefore  slowest)  set‐\nting  and  254  the  fastest  (and loudest). Some drives have only two levels (quiet /\nfast), while others may have different levels between 128 and  254.   At  the  moment,\nmost  drives  only  support 3 options, off, quiet, and fast.  These have been assigned\nthe values 0, 128, and 254 at present, respectively, but integer space has been incor‐\nporated for future expansion, should this change.\n\n-n     Get or set the \"ignorewriteerrors\" flag in the driver.  Do NOT play with this  with‐\nout grokking the driver source code first.\n\n-N     Get/set  max visible number of sectors, also known as the Host Protected Area setting.\nWithout a parameter, -N displays the current setting, which is reported as two values:\nthe first gives the current max sectors setting,  and  the  second  shows  the  native\n(real) hardware limit for the disk.  The difference between these two values indicates\nhow  many  sectors  of the disk are currently hidden from the operating system, in the\nform of a Host Protected Area (HPA).  This area is often used by  computer  makers  to\nhold  diagnostic  software,  and/or a copy of the originally provided operating system\nfor recovery purposes.  Another possible use is to hide the true capacity  of  a  very\nlarge  disk  from  a  BIOS/system  that  cannot normally cope with drives of that size\n(e.g., most current {2010} BIOSs cannot deal with drives larger than 2 TB, so  an  HPA\ncould  be used to cause a 3 TB drive to report itself as a 2 TB drive).  To change the\ncurrent max (VERY DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a  new  value  should  be\nprovided  (in base10) immediately following the -N option.  This value is specified as\na count of sectors, rather than the \"max sector address\" of the  drive.   Drives  have\nthe  concept  of a temporary (volatile) setting which is lost on the next hardware re‐\nset, as well as a more permanent (non-volatile) value which survives resets and  power\ncycles.   By default, -N affects only the temporary (volatile) setting.  To change the\npermanent (non-volatile) value, prepend a leading p character immediately  before  the\nfirst digit of the value.  Drives are supposed to allow only a single permanent change\nper  session.   A hardware reset (or power cycle) is required before another permanent\n-N operation can succeed.  Note that any attempt to set this value  may  fail  if  the\ndisk  is  being  accessed by other software at the same time.  This is because setting\nthe value requires a pair of back-to-back drive commands, but there is no way to  pre‐\nvent  some  other  command  from  being inserted between them by the kernel.  So if it\nfails initially, just try again.  Kernel support for -N  is  buggy  for  many  adapter\ntypes  across many kernel versions, in that an incorrect (too small) max size value is\nsometimes reported.  As of the 2.6.27 kernel, this does finally seem to be working  on\nmost hardware.\n\n--offset\nOffsets  to  given number of GiB (1024*1024*1024) when performing -t timings of device\nreads.  Speed changes (about twice) along many mechanical drives.  Usually the maximum\nis at the beginning, but not always.  Solid-state drives (SSDs)  should  show  similar\ntimings regardless of offset.\n\n-p     Attempt  to reprogram the IDE interface chipset for the specified PIO mode, or attempt\nto auto-tune for the \"best\" PIO mode supported by the drive.   This  feature  is  sup‐\nported  in  the  kernel  for only a few \"known\" chipsets, and even then the support is\niffy at best.  Some IDE chipsets are unable to alter the PIO mode for a single  drive,\nin  which case this option may cause the PIO mode for both drives to be set.  Many IDE\nchipsets support either fewer or more than the standard six (0 to 5) PIO modes, so the\nexact speed setting that is actually implemented will vary by chipset/driver sophisti‐\ncation.  Use with extreme caution!  This feature includes zero protection for the  un‐\nwary, and an unsuccessful outcome may result in severe filesystem corruption!\n\n-P     Set  the  maximum  sector  count for the drive's internal prefetch mechanism.  Not all\ndrives support this feature, and it was dropped from the official spec as of ATA-4.\n\n--prefer-ata12\nWhen using the SAT (SCSI ATA Translation) protocol, hdparm normally prefers to use the\n16-byte command format whenever possible.  But some USB drive  enclosures  don't  work\ncorrectly  with 16-byte commands.  This option can be used to force use of the smaller\n12-byte command format with such drives.  hdparm will still revert to 16-byte commands\nfor things that cannot be done with the 12-byte format (e.g., sector  accesses  beyond\n28-bits).\n\n-q     Handle  the  next  option quietly, suppressing normal output (but not error messages).\nThis is useful for reducing screen clutter when running from system  startup  scripts.\nNot applicable to the -i or -v or -t or -T options.\n\n-Q     Get  or set the device's command queuedepth, if supported by the hardware.  This only\nworks with 2.6.xx (or later) kernels, and only with  device  and  driver  combinations\nwhich  support  changing  the queuedepth.  For SATA disks, this is the Native Command\nQueuing (NCQ) queue depth.\n\n-r     Get/set read-only flag for the device.  When set, Linux disallows write operations  on\nthe device.\n\n-R     Get/set  Write-Read-Verify feature, if the drive supports it.  Usage: -R0 (disable) or",
            "subsections": [
                {
                    "name": "-R1 (enable)",
                    "content": "back any data that is written by software, to verify that the  data  was  successfully\nwritten.   This  is  generally overkill, and can slow down disk writes by as much as a\nfactor of two (or more).\n\n--read-sector\nReads from the specified sector number, and dumps the contents in hex to standard out‐\nput.  The sector number must be given (base10) after this option.  hdparm will issue a\nlow-level read (completely bypassing the usual block layer read/write mechanisms)  for\nthe  specified  sector.  This can be used to definitively check whether a given sector\nis bad (media error) or not (doing so through the usual mechanisms can sometimes  give\nfalse positives).\n\n--repair-sector\nThis is an alias for the --write-sector option.  VERY DANGEROUS.\n\n-s     Enable/disable  the power-on in standby feature, if supported by the drive.  VERY DAN‐\nGEROUS.  Do not use unless you are absolutely certain that both the  system  BIOS  (or\nfirmware) and the operating system kernel (Linux >= 2.6.22) support probing for drives\nthat  use  this feature.  When enabled, the drive is powered-up in the standby mode to\nallow the controller to sequence the spin-up of devices,  reducing  the  instantaneous\ncurrent draw burden when many drives share a power supply.  Primarily for use in large\nRAID  setups.  This feature is usually disabled and the drive is powered-up in the ac‐\ntive mode (see -C above).  Note that a drive may also allow enabling this feature by a\njumper.  Some SATA drives support the control of this feature by pin 11  of  the  SATA\npower  connector.  In  these cases, this command may be unsupported or may have no ef‐\nfect.\n\n-S     Put the drive into idle (low-power) mode, and also set the standby (spindown)  timeout\nfor  the drive.  This timeout value is used by the drive to determine how long to wait\n(with no disk activity) before turning off the spindle motor  to  save  power.   Under\nsuch  circumstances,  the  drive may take as long as 30 seconds to respond to a subse‐\nquent disk access, though most drives are much quicker.  The encoding of  the  timeout\nvalue is somewhat peculiar.  A value of zero means \"timeouts are disabled\": the device\nwill  not automatically enter standby mode.  Values from 1 to 240 specify multiples of\n5 seconds, yielding timeouts from 5 seconds to 20 minutes.  Values  from  241  to  251\nspecify  from  1  to  11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5\nhours.  A value of 252 signifies a timeout of 21 minutes. A value of 253 sets  a  ven‐\ndor-defined timeout period between 8 and 12 hours, and the value 254 is reserved.  255\nis  interpreted  as  21 minutes plus 15 seconds.  Note that some older drives may have\nvery different interpretations of these values.\n\n--set-sector-size\nFor drives which support reconfiguring of the Logical Sector Size, this  flag  can  be\nused  to  specify  the  new  desired  sector size in bytes.  VERY DANGEROUS. This most\nlikely will scramble all data on the drive.  The specified size must be  one  of  512,\n520,  528,  4096,  4160,  or  4224.  Very few drives support values other than 512 and\n4096.  Eg.  hdparm --set-sector-size 4096 /dev/sdb\n\n-t     Perform timings of device reads for benchmark and comparison purposes.  For meaningful\nresults, this operation should be repeated 2–3 times on an otherwise  inactive  system\n(no  other active processes) with at least a couple of megabytes of free memory.  This\ndisplays the speed of reading through the buffer cache to the disk without  any  prior\ncaching  of data.  This measurement is an indication of how fast the drive can sustain\nsequential data reads under Linux, without any filesystem overhead.  To  ensure  accu‐\nrate  measurements,  the buffer cache is flushed during the processing of -t using the\nBLKFLSBUF ioctl.\n\n-T     Perform timings of cache reads for benchmark and comparison purposes.  For  meaningful\nresults,  this  operation should be repeated 2–3 times on an otherwise inactive system\n(no other active processes) with at least a couple of megabytes of free memory.   This\ndisplays  the  speed  of reading directly from the Linux buffer cache without disk ac‐\ncess.  This measurement is essentially an indication of the throughput of the  proces‐\nsor, cache, and memory of the system under test.\n\n--trim-sector-ranges\nFor  Solid  State  Drives  (SSDs).   EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!!\nTells the drive firmware to discard unneeded data sectors, destroying  any  data  that\nmay  have  been present within them.  This makes those sectors available for immediate\nuse by the firmware's garbage collection mechanism, to improve  scheduling  for  wear-\nleveling of the flash media.  This option expects one or more sector range pairs imme‐\ndiately  after  the  option: an LBA starting address, a colon, and a sector count (max\n65535), with no intervening spaces.  EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!!\n\nE.g., hdparm --trim-sector-ranges 1000:4 7894:16 /dev/sdz\n\n--trim-sector-ranges-stdin\nIdentical to --trim-sector-ranges above, except the list of lba:count  pairs  is  read\nfrom stdin rather than being specified on the command line.  This can be used to avoid\nproblems  with  excessively long command lines.  It also permits batching of many more\nsector ranges into single commands to the drive, up to the currently configured trans‐\nfer limit (maxsectorskb).\n\n-u     Get/set the interrupt-unmask flag for the drive.  A setting of 1 permits the driver to\nunmask other interrupts during processing of a disk interrupt, which greatly  improves\nLinux's  responsiveness and eliminates \"serial port overrun\" errors.  Use this feature\nwith caution: some drive/controller combinations do not tolerate the increased I/O la‐\ntencies possible when this feature is enabled, resulting in massive filesystem corrup‐\ntion.  In particular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable (due  to\na  hardware  flaw)  when this option is used with kernel versions earlier than 2.0.13.\nDisabling the IDE prefetch feature of these interfaces (usually a  BIOS/CMOS  setting)\nprovides a safe fix for the problem for use with earlier kernels.\n\n-v     Display  some  basic settings, similar to -acdgkmur for IDE.  This is also the default\nbehaviour when no options are specified.\n\n-V     Display program version and exit immediately.\n\n--verbose\nDisplay extra diagnostics from some commands.\n\n-w     Perform a device reset (DANGEROUS).  Do NOT use this option.  It exists  for  unlikely\nsituations  where  a  reboot  might otherwise be required to get a confused drive back\ninto a useable state.\n\n--write-sector\nWrites zeros to the specified sector number.  VERY DANGEROUS.  The sector number  must\nbe  given (base10) after this option.  hdparm will issue a low-level write (completely\nbypassing the usual block layer read/write mechanisms) to the specified sector.   This\ncan be used to force a drive to repair a bad sector (media error).\n\n-W     Get/set the IDE/SATA drive's write-caching feature.\n\n-X     Set  the  IDE transfer mode for (E)IDE/ATA drives.  This is typically used in combina‐\ntion with -d1 when enabling DMA to/from a drive  on  a  supported  interface  chipset,\nwhere -X mdma2 is used to select multiword DMA mode2 transfers and -X sdma1 is used to\nselect  simple  mode  1 DMA transfers.  With systems which support UltraDMA burst tim‐\nings, -X udma2 is used to select UltraDMA mode2 transfers (you'll need to prepare  the\nchipset  for UltraDMA beforehand).  Apart from that, use of this option is seldom nec‐\nessary since most/all modern IDE drives default to their fastest PIO transfer mode  at\npower-on.  Fiddling with this can be both needless and risky.  On drives which support\nalternate  transfer modes, -X can be used to switch the mode of the drive only.  Prior\nto changing the transfer mode, the IDE interface should be jumpered or programmed (see\n-p option) for the new mode setting to prevent loss and/or corruption  of  data.   Use\nthis  with extreme caution!  For the PIO (Programmed Input/Output) transfer modes used\nby Linux, this value is simply the desired PIO mode number plus 8.  Thus, a  value  of\n09  sets  PIO  mode1,  10 enables PIO mode2, and 11 selects PIO mode3.  Setting 00 re‐\nstores the drive's \"default\" PIO mode, and 01 disables IORDY.  For multiword DMA,  the\nvalue used is the desired DMA mode number plus 32.  for UltraDMA, the value is the de‐\nsired UltraDMA mode number plus 64.\n\n-y     Force  an  IDE drive to immediately enter the low power consumption standby mode, usu‐\nally causing it to spin down.  The current power mode status can be checked using  the\n-C option.\n\n-Y     Force an IDE drive to immediately enter the lowest power consumption sleep mode, caus‐\ning it to shut down completely.  A hard or soft reset is required before the drive can\nbe  accessed  again  (the  Linux  IDE driver will automatically handle issuing a reset\nif/when needed).  The current power mode status can be checked using the -C option.\n\n-z     Force a kernel re-read of the partition table of the specified device(s).\n\n-Z     Disable the automatic power-saving function of certain  Seagate  drives  (ST3xxx  mod‐\nels?), to prevent them from idling/spinning-down at inconvenient times.\n\nATA Security Feature Set\nThese  switches  are DANGEROUS to experiment with, and might not work with some kernels.  USE"
                },
                {
                    "name": "AT YOUR OWN RISK.",
                    "content": "--security-help\nDisplay terse usage info for all of the --security-* options.\n\n--security-freeze\nFreeze the drive's security settings.  The drive does not accept any security commands\nuntil next power-on reset.  Use this function in combination with --security-unlock to\nprotect drive from any attempt to set a new password. Can be used standalone, too.  No\nother options are permitted on the command line with this one.\n\n--security-prompt-for-password\nPrompt for the --security PWD rather than getting from the command  line  args.   This\navoids  having passwords show up in shell history or in /proc/self/cmdline during exe‐\ncution.\n\n--security-unlock PWD\nUnlock the drive, using password PWD.  Password is given as an  ASCII  string  and  is\npadded  with  NULs  to reach 32 bytes.  The applicable drive password is selected with\nthe --user-master switch (default is \"user\" password).  No other options are permitted\non the command line with this one.\n\n--security-set-pass PWD\nLock the drive, using password PWD (Set Password) (DANGEROUS).  Password is  given  as\nan  ASCII  string and is padded with NULs to reach 32 bytes.  Use the special password\nNULL to set an empty password.  The applicable drive password  is  selected  with  the\n--user-master  switch  (default  is  \"user\" password) and the applicable security mode\nwith the --security-mode switch.  No other options are permitted on the  command  line\nwith this one.\n\n--security-disable PWD\nDisable  drive  locking, using password PWD.  Password is given as an ASCII string and\nis padded with NULs to reach 32 bytes.  The applicable drive password is selected with\nthe --user-master switch (default is \"user\" password).  No other options are permitted\non the command line with this one.\n\n--security-erase PWD\nErase (locked) drive, using password PWD (DANGEROUS).  Password is given as  an  ASCII\nstring  and  is  padded with NULs to reach 32 bytes.  Use the special password NULL to\nrepresent an empty password.  The applicable  drive  password  is  selected  with  the\n--user-master  switch (default is \"user\" password).  No other options are permitted on\nthe command line with this one.\n\n--security-erase-enhanced PWD\nEnhanced erase (locked) drive, using password PWD (DANGEROUS).  Password is  given  as\nan ASCII string and is padded with NULs to reach 32 bytes.  The applicable drive pass‐\nword is selected with the --user-master switch (default is \"user\" password).  No other\noptions are permitted on the command line with this one.\n\n--user-master USER\nSpecifies  which  password  (user/master) to select.  Defaults to user password.  Only\nuseful in combination with --security-unlock, --security-set-pass, --security-disable,\n--security-erase or --security-erase-enhanced.\nu       user password\nm       master password\n\n\n--security-mode MODE\nSpecifies which security mode (high/maximum) to set.  Defaults to high.   Only  useful\nin combination with --security-set-pass.\nh       high security\nm       maximum security\n\nTHIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/hdparm.conf\n",
            "subsections": []
        },
        "BUGS": {
            "content": "As  noted  above,  the  -m  sectcount  and -u 1 options should be used with caution at first,\npreferably on a read-only filesystem.  Most drives work well with these features, but  a  few\ndrive/controller  combinations  are  not  100% compatible.  Filesystem corruption may result.\nBackup everything before experimenting!\n\nSome options (e.g., -r for SCSI) may not work with old kernels as  necessary  ioctl()'s  were\nnot supported.\n\nAlthough  this utility is intended primarily for use with SATA/IDE hard disk devices, several\nof the options are also valid (and permitted) for use with SCSI hard disk devices and MFM/RLL\nhard disks with XT interfaces.\n\nThe Linux kernel up until 2.6.12 (and probably later) doesn't handle the security unlock  and\ndisable commands gracefully and will segfault and in some cases even panic. The security com‐\nmands  however might indeed have been executed by the drive. This poor kernel behaviour makes\nthe PIO data security commands rather useless at the moment.\n\nNote that the \"security erase\" and \"security disable\" commands have been implemented  as  two\nconsecutive  PIO data commands and will not succeed on a locked drive because the second com‐\nmand will not be issued after the segfault.  See the code for hints  how  patch  it  to  work\naround  this problem. Despite the segfault it is often still possible to run two instances of\nhdparm consecutively and issue the two necessary commands that way.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "hdparm has been written by Mark Lord <mlord@pobox.com>, the original  primary  developer  and\nmaintainer  of  the (E)IDE driver for Linux, and current contributor to the libata subsystem,\nalong with suggestions and patches from many netfolk.\n\nThe   disable   Seagate   auto-powersaving   code   is    courtesy    of    Tomi    Leppikan‐\ngas(tomilepp@paju.oulu.fi).\n\nSecurity freeze command by Benjamin Benz, 2005.\n\nPIO data out security commands by Leonard den Ottolander, 2005.  Some other parts by Benjamin\nBenz and others.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "http://www.t13.org/ Technical Committee T13 AT Attachment (ATA/ATAPI) Interface.\n\nhttp://www.serialata.org/ Serial ATA International Organization.\n\nhttp://www.compactflash.org/ CompactFlash Association.\n\nVersion 9.65                                  Sep 2022                                     HDPARM(8)",
            "subsections": []
        }
    },
    "summary": "hdparm - get/set SATA/IDE device parameters",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "back any data that is written by software, to verify that the data was successfully written. This is generally overkill, and can slow down disk writes by as much as a factor of two (or more). --read-sector Reads from the specified sector number, and dumps the contents in hex to standard out‐ put. The sector number must be given (base10) after this option. hdparm will issue a low-level read (completely bypassing the usual block layer read/write mechanisms) for the specified sector. This can be used to definitively check whether a given sector is bad (media error) or not (doing so through the usual mechanisms can sometimes give false positives). --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. VERY DAN‐ GEROUS. Do not use unless you are absolutely certain that both the system BIOS (or firmware) and the operating system kernel (Linux >= 2.6.22) support probing for drives that use this feature. When enabled, the drive is powered-up in the standby mode to allow the controller to sequence the spin-up of devices, reducing the instantaneous current draw burden when many drives share a power supply. Primarily for use in large RAID setups. This feature is usually disabled and the drive is powered-up in the ac‐ tive mode (see -C above). Note that a drive may also allow enabling this feature by a jumper. Some SATA drives support the control of this feature by pin 11 of the SATA power connector. In these cases, this command may be unsupported or may have no ef‐ fect. -S Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive. This timeout value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subse‐ quent disk access, though most drives are much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means \"timeouts are disabled\": the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a ven‐ dor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values. --set-sector-size For drives which support reconfiguring of the Logical Sector Size, this flag can be used to specify the new desired sector size in bytes. VERY DANGEROUS. This most likely will scramble all data on the drive. The specified size must be one of 512, 520, 528, 4096, 4160, or 4224. Very few drives support values other than 512 and 4096. Eg. hdparm --set-sector-size 4096 /dev/sdb -t Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2–3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache to the disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead. To ensure accu‐ rate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl. -T Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2–3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linux buffer cache without disk ac‐ cess. This measurement is essentially an indication of the throughput of the proces‐ sor, cache, and memory of the system under test. --trim-sector-ranges For Solid State Drives (SSDs). EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!! Tells the drive firmware to discard unneeded data sectors, destroying any data that may have been present within them. This makes those sectors available for immediate use by the firmware's garbage collection mechanism, to improve scheduling for wear- leveling of the flash media. This option expects one or more sector range pairs imme‐ diately after the option: an LBA starting address, a colon, and a sector count (max 65535), with no intervening spaces. EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!! 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 read from stdin rather than being specified on the command line. This can be used to avoid problems with excessively long command lines. It also permits batching of many more sector ranges into single commands to the drive, up to the currently configured trans‐ fer limit (maxsectorskb). -u Get/set the interrupt-unmask flag for the drive. A setting of 1 permits the driver to unmask other interrupts during processing of a disk interrupt, which greatly improves Linux's responsiveness and eliminates \"serial port overrun\" errors. Use this feature with caution: some drive/controller combinations do not tolerate the increased I/O la‐ tencies possible when this feature is enabled, resulting in massive filesystem corrup‐ tion. In particular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable (due to a hardware flaw) when this option is used with kernel versions earlier than 2.0.13. Disabling the IDE prefetch feature of these interfaces (usually a BIOS/CMOS setting) provides a safe fix for the problem for use with earlier kernels. -v Display some basic settings, similar to -acdgkmur for IDE. This is also the default behaviour when no options are specified. -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 unlikely situations where a reboot might otherwise be required to get a confused drive back into a useable state. --write-sector Writes zeros to the specified sector number. VERY DANGEROUS. The sector number must be given (base10) after this option. hdparm will issue a low-level write (completely bypassing the usual block layer read/write mechanisms) to the specified sector. This can be used to force a drive to repair a bad sector (media error). -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 combina‐ tion with -d1 when enabling DMA to/from a drive on a supported interface chipset, where -X mdma2 is used to select multiword DMA mode2 transfers and -X sdma1 is used to select simple mode 1 DMA transfers. With systems which support UltraDMA burst tim‐ ings, -X udma2 is used to select UltraDMA mode2 transfers (you'll need to prepare the chipset for UltraDMA beforehand). Apart from that, use of this option is seldom nec‐ essary since most/all modern IDE drives default to their fastest PIO transfer mode at power-on. Fiddling with this can be both needless and risky. On drives which support alternate transfer modes, -X can be used to switch the mode of the drive only. Prior to changing the transfer mode, the IDE interface should be jumpered or programmed (see -p option) for the new mode setting to prevent loss and/or corruption of data. Use this with extreme caution! For the PIO (Programmed Input/Output) transfer modes used by Linux, this value is simply the desired PIO mode number plus 8. Thus, a value of 09 sets PIO mode1, 10 enables PIO mode2, and 11 selects PIO mode3. Setting 00 re‐ stores the drive's \"default\" PIO mode, and 01 disables IORDY. For multiword DMA, the value used is the desired DMA mode number plus 32. for UltraDMA, the value is the de‐ sired UltraDMA mode number plus 64. -y Force an IDE drive to immediately enter the low power consumption standby mode, usu‐ ally causing it to spin down. The current power mode status can be checked using the -C option. -Y Force an IDE drive to immediately enter the lowest power consumption sleep mode, caus‐ ing it to shut down completely. A hard or soft reset is required before the drive can be accessed again (the Linux IDE driver will automatically handle issuing a reset if/when needed). The current power mode status can be checked using the -C option. -z Force a kernel re-read of the partition table of the specified device(s). -Z Disable the automatic power-saving function of certain Seagate drives (ST3xxx mod‐ els?), to prevent them from idling/spinning-down at inconvenient times. ATA Security Feature Set These switches are DANGEROUS to experiment with, and might not work with some kernels. USE"
        }
    ],
    "examples": [],
    "see_also": []
}