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

FILES

686       /etc/hdparm.conf
687

BUGS

689       As  noted  above, the -m sectcount and -u 1 options should be used with
690       caution at first, preferably on a read-only  filesystem.   Most  drives
691       work  well with these features, but a few drive/controller combinations
692       are not 100% compatible.  Filesystem  corruption  may  result.   Backup
693       everything before experimenting!
694
695       Some options (e.g. -r for SCSI) may not work with old kernels as neces‐
696       sary ioctl()´s were not supported.
697
698       Although this utility is intended primarily for use with SATA/IDE  hard
699       disk devices, several of the options are also valid (and permitted) for
700       use with SCSI hard disk devices and MFM/RLL hard disks with  XT  inter‐
701       faces.
702
703       The  Linux  kernel  up until 2.6.12 (and probably later) doesn´t handle
704       the security unlock and disable commands gracefully and  will  segfault
705       and  in  some  cases  even  panic.  The security commands however might
706       indeed have been executed by the  drive.  This  poor  kernel  behaviour
707       makes the PIO data security commands rather useless at the moment.
708
709       Note  that  the  "security  erase" and "security disable" commands have
710       been implemented as two consecutive PIO data commands and will not suc‐
711       ceed  on  a  locked drive because the second command will not be issued
712       after the segfault.  See the code for hints how patch it to work around
713       this  problem.  Despite  the segfault it is often still possible to run
714       two instances of hdparm consecutively and issue the two necessary  com‐
715       mands that way.
716

AUTHOR

718       hdparm  has  been  written by Mark Lord <mlord@pobox.com>, the original
719       primary developer and maintainer of the (E)IDE driver  for  Linux,  and
720       current contributer to the libata subsystem, along with suggestions and
721       patches from many netfolk.
722
723       The disable Seagate auto-powersaving code is courtesy of Tomi Leppikan‐
724       gas(tomilepp@paju.oulu.fi).
725
726       Security freeze command by Benjamin Benz, 2005.
727
728       PIO  data  out security commands by Leonard den Ottolander, 2005.  Some
729       other parts by Benjamin Benz and others.
730

SEE ALSO

732       http://www.t13.org/ Technical Committee T13 AT  Attachment  (ATA/ATAPI)
733       Interface.
734
735       http://www.serialata.org/ Serial ATA International Organization.
736
737       http://www.compactflash.org/ CompactFlash Association.
738
739
740
741Version 9.43                     November 2012                       HDPARM(8)
Impressum