1HDPARM(8)                   System Manager's Manual                  HDPARM(8)
2
3
4

NAME

6       hdparm - get/set SATA/IDE device parameters
7

SYNOPSIS

9       hdparm [options] [device ...]
10

DESCRIPTION

12       hdparm  provides  a command line interface to various kernel interfaces
13       supported by the Linux SATA/PATA/SAS "libata" subsystem and  the  older
14       IDE driver subsystem.  Many newer (2008 and later) USB drive enclosures
15       now also support "SAT" (SCSI-ATA Command Translation) and therefore may
16       also  work  with  hdparm.   E.g. recent WD "Passport" models and recent
17       NexStar-3 enclosures.  Some options may work correctly  only  with  the
18       latest kernels.
19

OPTIONS

21       When  no  options  are  given, -acdgkmur is assumed.  For "Get/set" op‐
22       tions, a query without the optional  parameter  (e.g.  -d)  will  query
23       (get)  the  device state, and with a parameter (e.g., -d0) will set the
24       device state.
25
26       -a     Get/set sector count for filesystem (software) read-ahead.  This
27              is  used  to  improve  performance  in sequential reads of large
28              files, by prefetching additional blocks in anticipation of  them
29              being  needed  by the running task.  Many IDE drives also have a
30              separate  built-in  read-ahead  function,  which  augments  this
31              filesystem (software) read-ahead function.
32
33       -A     Get/set  the  IDE  drive´s read-lookahead feature (usually ON by
34              default).  Usage: -A0 (disable) or -A1 (enable).
35
36       -b     Get/set bus state.
37
38       -B     Get/set Advanced Power Management feature, if the drive supports
39              it.  A  low  value  means aggressive power management and a high
40              value means better performance.  Possible  settings  range  from
41              values  1  through  127 (which permit spin-down), and values 128
42              through 254 (which do not permit spin-down).  The highest degree
43              of  power  management  is  attained with a setting of 1, and the
44              highest I/O performance with a setting of 254.  A value  of  255
45              tells  hdparm to disable Advanced Power Management altogether on
46              the drive (not all drives support disabling it, but most do).
47
48       -c     Get/set (E)IDE 32-bit I/O support.  A numeric parameter  can  be
49              used  to enable/disable 32-bit I/O support.  Currently supported
50              values include 0 to disable 32-bit  I/O  support,  1  to  enable
51              32-bit  data  transfers,  and  3 to enable 32-bit data transfers
52              with a special sync sequence required  by  many  chipsets.   The
53              value  3  works  with nearly all 32-bit IDE chipsets, but incurs
54              slightly more overhead.   Note  that  "32-bit"  refers  to  data
55              transfers  across  a  PCI or VLB bus to the interface card only;
56              all (E)IDE drives still have only a 16-bit connection  over  the
57              ribbon cable from the interface card.
58
59       -C     Check  the  current  IDE power mode status, which will always be
60              one of unknown  (drive  does  not  support  this  command),  ac‐
61              tive/idle (normal operation), standby (low power mode, drive has
62              spun down), or sleeping (lowest power mode, drive is  completely
63              shut  down).   The -S, -y, -Y, and -Z options can be used to ma‐
64              nipulate the IDE power modes.
65
66       -d     Get/set the "using_dma" flag for this drive.   This  option  now
67              works  with most combinations of drives and PCI interfaces which
68              support DMA and which are known to the kernel IDE driver.  It is
69              also a good idea to use the appropriate -X option in combination
70              with -d1 to ensure that the drive itself is programmed  for  the
71              correct  DMA mode, although most BIOSs should do this for you at
72              boot time.  Using DMA nearly always gives the best  performance,
73              with  fast  I/O  throughput and low CPU usage.  But there are at
74              least a few configurations of chipsets and drives for which  DMA
75              does not make much of a difference, or may even slow things down
76              (on really messed up hardware!).  Your mileage may vary.
77
78       --dco-freeze
79              DCO stands for Device Configuration Overlay, a way  for  vendors
80              to  selectively disable certain features of a drive.  The --dco-
81              freeze option will freeze/lock the current drive  configuration,
82              thereby  preventing  software (or malware) from changing any DCO
83              settings until after the next power-on reset.
84
85       --dco-identify
86              Query and dump information regarding  drive  configuration  set‐
87              tings  which  can  be  disabled  by the vendor or OEM installer.
88              These settings show capabilities of the  drive  which  might  be
89              disabled  by the vendor for "enhanced compatibility".  When dis‐
90              abled, they are otherwise hidden and will not  show  in  the  -I
91              identify  output.  For example, system vendors sometimes disable
92              48_bit addressing on large drives, for compatibility  (and  loss
93              of  capacity)  with a specific BIOS.  In such cases, --dco-iden‐
94              tify will show that the drive is 48_bit capable, but -I will not
95              show it, and nor will the drive accept 48_bit commands.
96
97       --dco-restore
98              Reset  all  drive  settings, features, and accessible capacities
99              back to factory defaults and full  capabilities.   This  command
100              will  fail if DCO is frozen/locked, or if a -Np maximum size re‐
101              striction has also been set.  This is  EXTREMELY  DANGEROUS  and
102              will  very  likely  cause massive loss of data.  DO NOT USE THIS
103              COMMAND.
104
105       --direct
106              Use the kernel´s "O_DIRECT" flag when  performing  a  -t  timing
107              test.  This bypasses the page cache, causing the reads to go di‐
108              rectly from the drive into  hdparm's  buffers,  using  so-called
109              "raw"  I/O.  In many cases, this can produce results that appear
110              much faster than the usual page cache method,  giving  a  better
111              indication of raw device and driver performance.
112
113       --drq-hsm-error
114              VERY  DANGEROUS,  DON'T  EVEN THINK ABOUT USING IT.  This option
115              causes hdparm to issue an IDENTIFY command to  the  kernel,  but
116              incorrectly marked as a "non-data" command.  This results in the
117              drive being left with its  DataReQust(DRQ)  line  "stuck"  high.
118              This confuses the kernel drivers, and may crash the system imme‐
119              diately with massive data loss.  The option exists  to  help  in
120              testing  and  fortifying  the  kernel against similar real-world
121              drive malfunctions.  VERY DANGEROUS, DO NOT USE!!
122
123       -D     Enable/disable the on-drive defect management  feature,  whereby
124              the  drive firmware tries to automatically manage defective sec‐
125              tors by relocating them to "spare" sectors reserved by the  fac‐
126              tory for such.  Control of this feature via the -D option is not
127              supported for most modern drives since ATA-4; thus this  command
128              may fail.
129
130       -E     Set cd/dvd drive speed.  This is NOT necessary for regular oper‐
131              ation, as the drive will automatically switch speeds on its own.
132              But  if you want to play with it, just supply a speed number af‐
133              ter the option, usually a number like 2 or 4.  This can be  use‐
134              ful in some cases, though, to smooth out DVD video playback.
135
136       -f     Sync  and  flush  the buffer cache for the device on exit.  This
137              operation is also performed internally as part of the -t and  -T
138              timings and other options.
139
140       --fallocate
141              This  option  currently  works  only  on ext4 and xfs filesystem
142              types.  When used, this must be the only option given.   It  re‐
143              quires two parameters: the desired file size in kilo-bytes (byte
144              count divided by 1024), followed by the  pathname  for  the  new
145              file.   It  will  create  a  new file of the specified size, but
146              without actually having to write any data  to  the  file.   This
147              will  normally  complete very quickly, and without thrashing the
148              storage device.
149
150              E.g. Create a 10KByte file: hdparm --fallocate 10 temp_file
151
152       --fibmap
153              When used, this must be the only option given.   It  requires  a
154              file path as a parameter, and will print out a list of the block
155              extents (sector ranges) occupied by that file on  disk.   Sector
156              numbers  are given as absolute LBA numbers, referenced from sec‐
157              tor 0 of the physical device rather than from the  partition  or
158              filesystem.   This information can then be used for a variety of
159              purposes, such as examining the degree of fragmenation of larger
160              files,  or  determining appropriate sectors to deliberately cor‐
161              rupt during fault-injection testing procedures.
162
163              This option uses the new FIEMAP (file extent map)  ioctl()  when
164              available,  and  falls back to the older FIBMAP (file block map)
165              ioctl() otherwise.  Note  that  FIBMAP  suffers  from  a  32-bit
166              block-number  interface,  and  thus not work beyond 8TB or 16TB.
167              FIBMAP is also very slow, and does not deal well  with  preallo‐
168              cated  uncommitted  extents  in  ext4/xfs  filesystems, unless a
169              sync() is done before using this option.
170
171       --fwdownload
172              When used, this should be the only option given.  It requires  a
173              file path immediately after the option, indicating where the new
174              drive firmware should be read from.  The contents of  this  file
175              will  be  sent  to the drive using the (S)ATA DOWNLOAD MICROCODE
176              command, using either transfer protocol 7 (entire file at once),
177              or,  if  the  drive  supports it, transfer protocol 3 (segmented
178              download).  This command is EXTREMELY DANGEROUS  and  could  de‐
179              stroy  both  the drive and all data on it.  DO NOT USE THIS COM‐
180              MAND.  The --fwdownload-mode3  ,  --fwdownload-mode3-max  ,  and
181              --fwdownload-mode7  variations on basic --fwdownload allow over‐
182              riding automatic protocol detection in favour of forcing  hdparm
183              to use a specific transfer protocol, for testing purposes only.
184
185       -F     Flush  the on-drive write cache buffer (older drives may not im‐
186              plement this).
187
188       -g     Display the drive geometry (cylinders, heads, sectors), the size
189              (in sectors) of the device, and the starting offset (in sectors)
190              of the device from the beginning of the drive.
191
192       -h     Display terse usage information (help).
193
194       -H     Read the temperature from some (mostly  Hitachi)  drives.   Also
195              reports  if  the temperature is within operating condition range
196              (this may not be reliable). Does not cause the drive to spin  up
197              if idle.
198
199       -i     Display  the  identification info which the kernel drivers (IDE,
200              libata) have stored from boot/configuration time.  This may dif‐
201              fer  from  the  current information obtainable directly from the
202              drive itself with the -I option.  The data returned may  or  may
203              not  be current, depending on activity since booting the system.
204              For a more detailed interpretation of the  identification  info,
205              refer  to  AT  Attachment  Interface  for  Disk Drives, ANSI ASC
206              X3T9.2 working draft, revision 4a, April 19/93, and  later  edi‐
207              tions.
208
209       --idle-immediate
210              Issue  an  ATA  IDLE_IMMEDIATE  command, to put the drive into a
211              lower power state.  Usually the device remains spun-up.
212
213       --idle-unload
214              Issue an ATA IDLE_IMMEDIATE_WITH_UNLOAD command,  to  unload  or
215              park the heads and put the drive into a lower power state.  Usu‐
216              ally the device remains spun-up.
217
218       -I     Request identification info directly from the  drive,  which  is
219              displayed in a new expanded format with considerably more detail
220              than with the older -i option.
221
222       --Iraw <pathname>
223              This option dumps the drive's identify data in raw binary to the
224              specified file.
225
226       --Istdin
227              This  is  a  special variation on the -I option, which accepts a
228              drive identification block as standard input instead of using  a
229              /dev/hd*  parameter.   The  format of this block must be exactly
230              the same as that found in the /proc/ide/*/hd*/identify  "files",
231              or  that produced by the --Istdout option described below.  This
232              variation is designed for  use  with  collected  "libraries"  of
233              drive  identification information, and can also be used on ATAPI
234              drives which may give media errors with the standard  mechanism.
235              When  --Istdin  is  used, it must be the *only* parameter given.
236              Note that some information will be incomplete, as the drive  LOG
237              PAGES are unavailable when --Istdin is used.
238
239       --Istdout
240              This option dumps the drive's identify data in hex to stdout, in
241              a format similar to that from /proc/ide/*/identify, and suitable
242              for later use with the --Istdin option.
243
244       -J     Get/set  the  Western Digital (WD) Green Drive's "idle3" timeout
245              value.  This timeout controls how  often  the  drive  parks  its
246              heads and enters a low power consumption state.  The factory de‐
247              fault is eight (8) seconds, which is a very poor choice for  use
248              with  Linux.   Leaving it at the default will result in hundreds
249              of thousands of head load/unload cycles in a very  short  period
250              of  time.   The  drive  mechanism  is  only rated for 300,000 to
251              1,000,000 cycles, so leaving it at the default could  result  in
252              premature  failure, not to mention the performance impact of the
253              drive often having to wake-up before doing routine I/O.
254
255              WD supply a WDIDLE3.EXE DOS utility for tweaking  this  setting,
256              and you should use that program instead of hdparm if at all pos‐
257              sible.  The reverse-engineered implementation in hdparm  is  not
258              as  complete  as  the  original official program, even though it
259              does seem to work on at a least a few drives.  A full power  cy‐
260              cle  is  required  for any change in setting to take effect, re‐
261              gardless of which program is used to tweak things.
262
263              A setting of 30 seconds is recommended for Linux use.  Permitted
264              values  are  from 8 to 12 seconds, and from 30 to 300 seconds in
265              30-second increments.  Specify a value of zero  (0)  to  disable
266              the WD idle3 timer completely (NOT RECOMMENDED!).
267
268       -k     Get/set the "keep_settings_over_reset" flag for the drive.  When
269              this flag is set, the drive will preserve the -dmu settings over
270              a  soft  reset,  (as  done  during the error recovery sequence).
271              This option defaults to off, to prevent drive reset loops  which
272              could be caused by combinations of -dmu settings.  The -k option
273              should therefore only be set after one has  achieved  confidence
274              in  correct  system operation with a chosen set of configuration
275              settings.  In practice, all that is typically necessary to  test
276              a  configuration (prior to using -k) is to verify that the drive
277              can be read/written, and that no error  logs  (kernel  messages)
278              are  generated in the process (look in /var/log/messages on most
279              systems).
280
281       -K     Set the drive´s "keep_features_over_reset" flag.   Setting  this
282              enables the drive to retain the settings for -APSWXZ over a soft
283              reset (as done during the error  recovery  sequence).   Not  all
284              drives support this feature.
285
286       -L     Set  the drive´s doorlock flag.  Setting this to 1 will lock the
287              door mechanism of some removable hard drives (e.g. Syquest, ZIP,
288              Jazz..),  and  setting  it  to 0 will unlock the door mechanism.
289              Normally, Linux maintains the door locking  mechanism  automati‐
290              cally, depending on drive usage (locked whenever a filesystem is
291              mounted).  But on system shutdown, this can be a nuisance if the
292              root  partition is on a removable disk, since the root partition
293              is left mounted (read-only) after shutdown.  So, by  using  this
294              command  to  unlock  the  door  after the root filesystem is re‐
295              mounted read-only, one can then remove the  cartridge  from  the
296              drive after shutdown.
297
298       -m     Get/set  sector  count  for multiple sector I/O on the drive.  A
299              setting of 0 disables this feature.  Multiple sector  mode  (aka
300              IDE  Block  Mode),  is a feature of most modern IDE hard drives,
301              permitting the transfer of multiple sectors per  I/O  interrupt,
302              rather  than the usual one sector per interrupt.  When this fea‐
303              ture is enabled, it typically reduces operating system  overhead
304              for  disk  I/O by 30-50%.  On many systems, it also provides in‐
305              creased data throughput  of  anywhere  from  5%  to  50%.   Some
306              drives, however (most notably the WD Caviar series), seem to run
307              slower with multiple mode enabled.  Your mileage may vary.  Most
308              drives support the minimum settings of 2, 4, 8, or 16 (sectors).
309              Larger settings may also be possible, depending on the drive.  A
310              setting of 16 or 32 seems optimal on many systems.  Western Dig‐
311              ital recommends lower settings of  4  to  8  on  many  of  their
312              drives,  due tiny (32kB) drive buffers and non-optimized buffer‐
313              ing algorithms.  The -i option can be used to find  the  maximum
314              setting supported by an installed drive (look for MaxMultSect in
315              the output).  Some drives claim to support  multiple  mode,  but
316              lose  data  at  some  settings.   Under rare circumstances, such
317              failures can result in massive filesystem corruption.
318
319       --make-bad-sector
320              Deliberately create a bad sector (aka.  "media  error")  on  the
321              disk.   EXCEPTIONALLY  DANGEROUS. DO NOT USE THIS OPTION!!  This
322              can be useful for testing of device/RAID error  recovery  mecha‐
323              nisms.  The sector number is given as a (base10) parameter after
324              the option.  Depending on the device, hdparm will choose one  of
325              two  possible  ATA  commands  for  corrupting  the  sector.  The
326              WRITE_LONG works on most drives, but only up to the 28-bit  sec‐
327              tor  boundary.   Some  very recent drives (2008) may support the
328              new WRITE_UNCORRECTABLE_EXT command, which works for  any  LBA48
329              sector.   If  available,  hdparm  will use that in preference to
330              WRITE_LONG.  The WRITE_UNCORRECTABLE_EXT command itself presents
331              a  choice  of how the new bad sector should behave.  By default,
332              it will look like any other bad sector, and the drive  may  take
333              some  time  to retry and fail on subsequent READs of the sector.
334              However, if a single letter f is prepended immediately in  front
335              of  the  first digit of the sector number parameter, then hdparm
336              will issue a "flagged" WRITE_UNCORRECTABLE_EXT, which causes the
337              drive  to  merely  flag the sector as bad (rather than genuinely
338              corrupt it), and subsequent READs of the sector will fail  imme‐
339              diately (rather than after several retries).  Note also that the
340              --repair-sector option can be used to restore (any) bad  sectors
341              when they are no longer needed, including sectors that were gen‐
342              uinely bad (the drive will likely remap those to a fresh area on
343              the media).
344
345       -M     Get/set Automatic Acoustic Management (AAM) setting. Most modern
346              harddisk drives have the ability to speed down  the  head  move‐
347              ments to reduce their noise output.  The possible values are be‐
348              tween 0 and 254. 128 is the most quiet (and  therefore  slowest)
349              setting and 254 the fastest (and loudest). Some drives have only
350              two levels (quiet / fast), while others may have different  lev‐
351              els  between  128 and 254.  At the moment, most drives only sup‐
352              port 3 options, off, quiet, and fast.  These have been  assigned
353              the values 0, 128, and 254 at present, respectively, but integer
354              space has been incorporated for future  expansion,  should  this
355              change.
356
357       -n     Get or set the "ignore_write_errors" flag in the driver.  Do NOT
358              play with this without grokking the driver source code first.
359
360       -N     Get/set max visible number of sectors, also known  as  the  Host
361              Protected  Area  setting.   Without a parameter, -N displays the
362              current setting, which is reported  as  two  values:  the  first
363              gives  the current max sectors setting, and the second shows the
364              native (real) hardware limit for the disk.  The  difference  be‐
365              tween  these  two  values indicates how many sectors of the disk
366              are currently hidden from the operating system, in the form of a
367              Host  Protected Area (HPA).  This area is often used by computer
368              makers to hold diagnostic software, and/or a copy of the  origi‐
369              nally  provided operating system for recovery purposes.  Another
370              possible use is to hide the true capacity of a very  large  disk
371              from a BIOS/system that cannot normally cope with drives of that
372              size (eg. most current {2010}  BIOSs  cannot  deal  with  drives
373              larger than 2TB, so an HPA could be used to cause a 3TB drive to
374              report itself as a 2TB drive).  To change the current max  (VERY
375              DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a new value should be
376              provided (in base10) immediately following the -N option.   This
377              value  is  specified as a count of sectors, rather than the "max
378              sector address" of the drive.  Drives have the concept of a tem‐
379              porary (volatile) setting which is lost on the next hardware re‐
380              set, as well as a more permanent (non-volatile) value which sur‐
381              vives  resets and power cycles.  By default, -N affects only the
382              temporary (volatile) setting.  To  change  the  permanent  (non-
383              volatile)  value,  prepend a leading p character immediately be‐
384              fore the first digit of the value.  Drives are supposed to allow
385              only  a  single  permanent change per session.  A hardware reset
386              (or power cycle) is required before another permanent -N  opera‐
387              tion  can  succeed.  Note that any attempt to set this value may
388              fail if the disk is being accessed by other software at the same
389              time.   This  is  because  setting  the value requires a pair of
390              back-to-back drive commands, but there is no way to prevent some
391              other  command  from  being inserted between them by the kernel.
392              So if it fails initially, just try again.  Kernel support for -N
393              is  buggy for many adapter types across many kernel versions, in
394              that an incorrect (too small) max size value  is  sometimes  re‐
395              ported.   As  of the 2.6.27 kernel, this does finally seem to be
396              working on most hardware.
397
398       --offset
399              Offsets to given number of GiB (1024*1024*1024) when  performing
400              -t  timings  of device reads.  Speed changes (about twice) along
401              many mechanical drives.  Usually the maximum is  at  the  begin‐
402              ning,  but  not  always.   Solid-state drives (SSDs) should show
403              similar timings regardless of offset.
404
405       -p     Attempt to reprogram the IDE interface chipset for the specified
406              PIO  mode,  or attempt to auto-tune for the "best" PIO mode sup‐
407              ported by the drive.  This feature is supported  in  the  kernel
408              for  only  a  few "known" chipsets, and even then the support is
409              iffy at best.  Some IDE chipsets are unable  to  alter  the  PIO
410              mode for a single drive, in which case this option may cause the
411              PIO mode for both drives to be set.  Many IDE  chipsets  support
412              either  fewer  or more than the standard six (0 to 5) PIO modes,
413              so the exact speed setting that  is  actually  implemented  will
414              vary  by  chipset/driver  sophistication.  Use with extreme cau‐
415              tion!  This feature includes zero protection for the unwary, and
416              an  unsuccessful outcome may result in severe filesystem corrup‐
417              tion!
418
419       -P     Set the maximum sector count for the drive´s  internal  prefetch
420              mechanism.   Not  all  drives  support  this feature, and it was
421              dropped from the official spec as of ATA-4.
422
423       --prefer-ata12
424              When using the SAT (SCSI ATA Translation) protocol, hdparm  nor‐
425              mally  prefers to use the 16-byte command format whenever possi‐
426              ble.  But some USB drive enclosures don't  work  correctly  with
427              16-byte  commands.   This option can be used to force use of the
428              smaller 12-byte command format with such  drives.   hdparm  will
429              still  revert to 16-byte commands for things that cannot be done
430              with the 12-byte format (e.g. sector accesses beyond 28-bits).
431
432       -q     Handle the next option quietly, suppressing normal  output  (but
433              not error messages).  This is useful for reducing screen clutter
434              when running from system startup scripts.  Not applicable to the
435              -i or -v or -t or -T options.
436
437       -Q     Get or set the device's command queue_depth, if supported by the
438              hardware.  This only works with 2.6.xx (or later)  kernels,  and
439              only  with device and driver combinations which support changing
440              the queue_depth.  For SATA disks, this  is  the  Native  Command
441              Queuing (NCQ) queue depth.
442
443       -r     Get/set  read-only  flag for the device.  When set, Linux disal‐
444              lows write operations on the device.
445
446       -R     Get/set Write-Read-Verify feature, if  the  drive  supports  it.
447              Usage:  -R0 (disable) or -R1 (enable).  This feature is intended
448              to have the drive firmware automatically read-back any data that
449              is written by software, to verify that the data was successfully
450              written.  This is generally overkill, and  can  slow  down  disk
451              writes by as much as a factor of two (or more).
452
453       --read-sector
454              Reads  from  the specified sector number, and dumps the contents
455              in hex to standard output.  The  sector  number  must  be  given
456              (base10)  after this option.  hdparm will issue a low-level read
457              (completely bypassing the usual block  layer  read/write  mecha‐
458              nisms)  for  the  specified sector.  This can be used to defini‐
459              tively check whether a given sector is bad (media error) or  not
460              (doing  so through the usual mechanisms can sometimes give false
461              positives).
462
463       --repair-sector
464              This is an alias for the --write-sector option.  VERY DANGEROUS.
465
466       -s     Enable/disable the power-on in standby feature, if supported  by
467              the  drive.   VERY  DANGEROUS.   Do not use unless you are abso‐
468              lutely certain that both the system BIOS (or firmware)  and  the
469              operating  system  kernel  (Linux >= 2.6.22) support probing for
470              drives that use this feature.  When enabled, the drive  is  pow‐
471              ered-up  in the standby mode to allow the controller to sequence
472              the spin-up of devices, reducing the instantaneous current  draw
473              burden when many drives share a power supply.  Primarily for use
474              in large RAID setups.  This feature is usually disabled and  the
475              drive  is  powered-up  in  the active mode (see -C above).  Note
476              that a drive may also allow enabling this feature by  a  jumper.
477              Some  SATA  drives support the control of this feature by pin 11
478              of the SATA power connector. In these cases, this command may be
479              unsupported or may have no effect.
480
481       -S     Put  the  drive  into  idle  (low-power)  mode, and also set the
482              standby (spindown) timeout for the drive.  This timeout value is
483              used  by  the  drive to determine how long to wait (with no disk
484              activity) before turning off the spindle motor  to  save  power.
485              Under  such circumstances, the drive may take as long as 30 sec‐
486              onds to respond to a subsequent disk access, though most  drives
487              are much quicker.  The encoding of the timeout value is somewhat
488              peculiar.  A value of zero means "timeouts  are  disabled":  the
489              device will not automatically enter standby mode.  Values from 1
490              to 240 specify multiples of 5 seconds, yielding timeouts from  5
491              seconds to 20 minutes.  Values from 241 to 251 specify from 1 to
492              11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5
493              hours.   A  value  of  252  signifies a timeout of 21 minutes. A
494              value of 253 sets a vendor-defined timeout period between 8  and
495              12  hours, and the value 254 is reserved.  255 is interpreted as
496              21 minutes plus 15 seconds.  Note that  some  older  drives  may
497              have very different interpretations of these values.
498
499       --set-sector-size
500              For  drives  which  support  reconfiguring of the Logical Sector
501              Size, this flag can be used to specify the  new  desired  sector
502              size  in  bytes.  VERY DANGEROUS. This most likely will scramble
503              all data on the drive.  The specified size must be one  of  512,
504              520,  528,  4096, 4160, or 4224.  Very few drives support values
505              other than 512 and 4096.   Eg.   hdparm  --set-sector-size  4096
506              /dev/sdb
507
508       -t     Perform  timings  of  device  reads for benchmark and comparison
509              purposes.  For meaningful results, this operation should be  re‐
510              peated  2-3  times on an otherwise inactive system (no other ac‐
511              tive processes) with at least a couple of megabytes of free mem‐
512              ory.   This  displays  the  speed  of reading through the buffer
513              cache to the disk without any prior caching of data.  This  mea‐
514              surement  is an indication of how fast the drive can sustain se‐
515              quential data reads under Linux, without  any  filesystem  over‐
516              head.   To  ensure  accurate  measurements,  the buffer cache is
517              flushed during the processing of -t using the BLKFLSBUF ioctl.
518
519       -T     Perform timings of cache reads for benchmark and comparison pur‐
520              poses.   For  meaningful  results,  this operation should be re‐
521              peated 2-3 times on an otherwise inactive system (no  other  ac‐
522              tive processes) with at least a couple of megabytes of free mem‐
523              ory.  This displays the speed of reading directly from the Linux
524              buffer  cache  without  disk access.  This measurement is essen‐
525              tially an indication of the throughput of the processor,  cache,
526              and memory of the system under test.
527
528       --trim-sector-ranges
529              For  Solid State Drives (SSDs).  EXCEPTIONALLY DANGEROUS. DO NOT
530              USE THIS OPTION!!  Tells the drive firmware to discard  unneeded
531              data  sectors,  destroying  any  data that may have been present
532              within them.  This makes those sectors available  for  immediate
533              use  by  the firmware's garbage collection mechanism, to improve
534              scheduling for wear-leveling of the flash  media.   This  option
535              expects one or more sector range pairs immediately after the op‐
536              tion: an LBA starting address, a colon, and a sector count  (max
537              65535), with no intervening spaces.  EXCEPTIONALLY DANGEROUS. DO
538              NOT USE THIS OPTION!!
539
540              E.g.  hdparm --trim-sector-ranges 1000:4 7894:16 /dev/sdz
541
542       --trim-sector-ranges-stdin
543              Identical to --trim-sector-ranges  above,  except  the  list  of
544              lba:count  pairs  is read from stdin rather than being specified
545              on the command line.  This can be used to  avoid  problems  with
546              excessively  long  command  lines.   It also permits batching of
547              many more sector ranges into single commands to the drive, up to
548              the currently configured transfer limit (max_sectors_kb).
549
550       -u     Get/set the interrupt-unmask flag for the drive.  A setting of 1
551              permits the driver to unmask other interrupts during  processing
552              of  a disk interrupt, which greatly improves Linux´s responsive‐
553              ness and eliminates "serial port overrun" errors.  Use this fea‐
554              ture  with  caution:  some  drive/controller combinations do not
555              tolerate the increased I/O latencies possible when this  feature
556              is enabled, resulting in massive filesystem corruption.  In par‐
557              ticular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable
558              (due  to  a  hardware flaw) when this option is used with kernel
559              versions earlier than 2.0.13.  Disabling the IDE  prefetch  fea‐
560              ture  of these interfaces (usually a BIOS/CMOS setting) provides
561              a safe fix for the problem for use with earlier kernels.
562
563       -v     Display some basic settings, similar to -acdgkmur for IDE.  This
564              is also the default behaviour when no options are specified.
565
566       -V     Display program version and exit immediately.
567
568       --verbose
569              Display extra diagnostics from some commands.
570
571       -w     Perform a device reset (DANGEROUS).  Do NOT use this option.  It
572              exists for unlikely situations where a reboot might otherwise be
573              required to get a confused drive back into a useable state.
574
575       --write-sector
576              Writes  zeros  to  the specified sector number.  VERY DANGEROUS.
577              The sector number must be given (base10) after this option.  hd‐
578              parm  will  issue  a  low-level  write (completely bypassing the
579              usual block layer read/write mechanisms) to the  specified  sec‐
580              tor.   This  can be used to force a drive to repair a bad sector
581              (media error).
582
583       -W     Get/set the IDE/SATA drive´s write-caching feature.
584
585       -X     Set the IDE transfer mode for (E)IDE/ATA drives.  This is  typi‐
586              cally  used  in combination with -d1 when enabling DMA to/from a
587              drive on a supported interface chipset, where -X mdma2  is  used
588              to  select multiword DMA mode2 transfers and -X sdma1 is used to
589              select simple mode 1 DMA transfers.  With systems which  support
590              UltraDMA  burst  timings,  -X  udma2  is used to select UltraDMA
591              mode2 transfers (you´ll need to prepare the chipset for UltraDMA
592              beforehand).  Apart from that, use of this option is seldom nec‐
593              essary since most/all modern IDE drives default to their fastest
594              PIO  transfer  mode at power-on.  Fiddling with this can be both
595              needless and risky.  On drives which support alternate  transfer
596              modes,  -X  can  be  used  to switch the mode of the drive only.
597              Prior to changing the transfer mode, the IDE interface should be
598              jumpered  or programmed (see -p option) for the new mode setting
599              to prevent loss and/or corruption of data.  Use  this  with  ex‐
600              treme  caution!   For the PIO (Programmed Input/Output) transfer
601              modes used by Linux, this value is simply the desired  PIO  mode
602              number  plus  8.  Thus, a value of 09 sets PIO mode1, 10 enables
603              PIO mode2, and 11 selects PIO mode3.  Setting  00  restores  the
604              drive´s  "default"  PIO mode, and 01 disables IORDY.  For multi‐
605              word DMA, the value used is the desired DMA mode number plus 32.
606              for UltraDMA, the value is the desired UltraDMA mode number plus
607              64.
608
609       -y     Force an IDE drive to immediately enter the low  power  consump‐
610              tion standby mode, usually causing it to spin down.  The current
611              power mode status can be checked using the -C option.
612
613       -Y     Force an IDE drive to immediately enter the  lowest  power  con‐
614              sumption sleep mode, causing it to shut down completely.  A hard
615              or soft reset is required before the drive can be accessed again
616              (the  Linux IDE driver will automatically handle issuing a reset
617              if/when needed).  The current power mode status can  be  checked
618              using the -C option.
619
620       -z     Force  a  kernel re-read of the partition table of the specified
621              device(s).
622
623       -Z     Disable the automatic power-saving function of  certain  Seagate
624              drives  (ST3xxx  models?), to prevent them from idling/spinning-
625              down at inconvenient times.
626
627
628       ATA Security Feature Set
629
630       These switches are DANGEROUS to experiment with,  and  might  not  work
631       with some kernels.  USE AT YOUR OWN RISK.
632
633       --security-help
634              Display terse usage info for all of the --security-* options.
635
636       --security-freeze
637              Freeze the drive´s security settings.  The drive does not accept
638              any security commands until next power-on reset.  Use this func‐
639              tion in combination with --security-unlock to protect drive from
640              any attempt to set a new password. Can be used standalone,  too.
641              No  other  options  are  permitted on the command line with this
642              one.
643
644       --security-prompt-for-password
645              Prompt for the --security PWD rather than getting from the  com‐
646              mand  line  args.  This avoids having passwords show up in shell
647              history or in /proc/self/cmdline during execution.
648
649       --security-unlock PWD
650              Unlock the drive, using password PWD.  Password is given  as  an
651              ASCII string and is padded with NULs to reach 32 bytes.  The ap‐
652              plicable drive  password  is  selected  with  the  --user-master
653              switch  (default is "user" password).  No other options are per‐
654              mitted on the command line with this one.
655
656       --security-set-pass PWD
657              Lock the drive, using password PWD (Set  Password)  (DANGEROUS).
658              Password  is given as an ASCII string and is padded with NULs to
659              reach 32 bytes.  Use the special password NULL to set  an  empty
660              password.   The  applicable  drive password is selected with the
661              --user-master switch (default is "user" password) and the appli‐
662              cable  security  mode with the --security-mode switch.  No other
663              options are permitted on the command line with this one.
664
665       --security-disable PWD
666              Disable drive locking, using password PWD.  Password is given as
667              an  ASCII string and is padded with NULs to reach 32 bytes.  The
668              applicable drive password is  selected  with  the  --user-master
669              switch  (default is "user" password).  No other options are per‐
670              mitted on the command line with this one.
671
672       --security-erase PWD
673              Erase (locked) drive, using password PWD (DANGEROUS).   Password
674              is  given as an ASCII string and is padded with NULs to reach 32
675              bytes.  Use the special password  NULL  to  represent  an  empty
676              password.   The  applicable  drive password is selected with the
677              --user-master switch (default is "user" password).  No other op‐
678              tions are permitted on the command line with this one.
679
680       --security-erase-enhanced PWD
681              Enhanced  erase  (locked) drive, using password PWD (DANGEROUS).
682              Password is given as an ASCII string and is padded with NULs  to
683              reach  32 bytes.  The applicable drive password is selected with
684              the --user-master switch (default is "user" password).  No other
685              options are permitted on the command line with this one.
686
687       --user-master USER
688              Specifies  which  password (user/master) to select.  Defaults to
689              user password.  Only useful in combination  with  --security-un‐
690              lock,  --security-set-pass, --security-disable, --security-erase
691              or --security-erase-enhanced.
692                      u       user password
693                      m       master password
694
695
696       --security-mode MODE
697              Specifies which security mode (high/maximum) to  set.   Defaults
698              to high.  Only useful in combination with --security-set-pass.
699                      h       high security
700                      m       maximum security
701
702              THIS  FEATURE  IS  EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR
703              OWN RISK.
704

FILES

706       /etc/hdparm.conf
707

BUGS

709       As noted above, the -m sectcount and -u 1 options should be  used  with
710       caution  at  first,  preferably on a read-only filesystem.  Most drives
711       work well with these features, but a few drive/controller  combinations
712       are not 100% compatible.  Filesystem corruption may result.  Backup ev‐
713       erything before experimenting!
714
715       Some options (e.g. -r for SCSI) may not work with old kernels as neces‐
716       sary ioctl()´s were not supported.
717
718       Although  this utility is intended primarily for use with SATA/IDE hard
719       disk devices, several of the options are also valid (and permitted) for
720       use  with  SCSI hard disk devices and MFM/RLL hard disks with XT inter‐
721       faces.
722
723       The Linux kernel up until 2.6.12 (and probably  later)  doesn´t  handle
724       the  security  unlock and disable commands gracefully and will segfault
725       and in some cases even panic. The security commands however  might  in‐
726       deed  have been executed by the drive. This poor kernel behaviour makes
727       the PIO data security commands rather useless at the moment.
728
729       Note that the "security erase" and  "security  disable"  commands  have
730       been implemented as two consecutive PIO data commands and will not suc‐
731       ceed on a locked drive because the second command will  not  be  issued
732       after the segfault.  See the code for hints how patch it to work around
733       this problem. Despite the segfault it is often still  possible  to  run
734       two  instances of hdparm consecutively and issue the two necessary com‐
735       mands that way.
736

AUTHOR

738       hdparm has been written by Mark Lord  <mlord@pobox.com>,  the  original
739       primary  developer  and  maintainer of the (E)IDE driver for Linux, and
740       current contributor to the libata subsystem, along with suggestions and
741       patches from many netfolk.
742
743       The disable Seagate auto-powersaving code is courtesy of Tomi Leppikan‐
744       gas(tomilepp@paju.oulu.fi).
745
746       Security freeze command by Benjamin Benz, 2005.
747
748       PIO data out security commands by Leonard den Ottolander,  2005.   Some
749       other parts by Benjamin Benz and others.
750

SEE ALSO

752       http://www.t13.org/  Technical  Committee T13 AT Attachment (ATA/ATAPI)
753       Interface.
754
755       http://www.serialata.org/ Serial ATA International Organization.
756
757       http://www.compactflash.org/ CompactFlash Association.
758
759
760
761Version 9.65                       Sep 2022                          HDPARM(8)
Impressum