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

FILES

709       /etc/hdparm.conf
710

BUGS

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

AUTHOR

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

SEE ALSO

755       http://www.t13.org/  Technical  Committee T13 AT Attachment (ATA/ATAPI)
756       Interface.
757
758       http://www.serialata.org/ Serial ATA International Organization.
759
760       http://www.compactflash.org/ CompactFlash Association.
761
762
763
764Version 9.43                     November 2012                       HDPARM(8)
Impressum