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

NAME

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

SYNOPSIS

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

FILES

659       /etc/hdparm.conf
660

BUGS

662       As noted above, the -m sectcount and -u 1 options should be  used  with
663       caution  at  first,  preferably on a read-only filesystem.  Most drives
664       work well with these features, but a few drive/controller  combinations
665       are  not  100%  compatible.   Filesystem corruption may result.  Backup
666       everything before experimenting!
667
668       Some options (eg. -r for SCSI) may not work with old kernels as  neces‐
669       sary ioctl()´s were not supported.
670
671       Although  this utility is intended primarily for use with SATA/IDE hard
672       disk devices, several of the options are also valid (and permitted) for
673       use  with  SCSI hard disk devices and MFM/RLL hard disks with XT inter‐
674       faces.
675
676       The Linux kernel up until 2.6.12 (and probably  later)  doesn´t  handle
677       the  security  unlock and disable commands gracefully and will segfault
678       and in some cases even  panic.  The  security  commands  however  might
679       indeed  have  been  executed  by  the drive. This poor kernel behaviour
680       makes the PIO data security commands rather useless at the moment.
681
682       Note that the "security erase" and  "security  disable"  commands  have
683       been implemented as two consecutive PIO data commands and will not suc‐
684       ceed on a locked drive because the second command will  not  be  issued
685       after the segfault.  See the code for hints how patch it to work around
686       this problem. Despite the segfault it is often still  possible  to  run
687       two  instances of hdparm consecutively and issue the two necessary com‐
688       mands that way.
689

AUTHOR

691       hdparm has been written by Mark Lord  <mlord@pobox.com>,  the  original
692       primary  developer  and  maintainer of the (E)IDE driver for Linux, and
693       current contributer to the libata subsystem, along with suggestions and
694       patches from many netfolk.
695
696       The disable Seagate auto-powersaving code is courtesy of Tomi Leppikan‐
697       gas(tomilepp@paju.oulu.fi).
698
699       Security freeze command by Benjamin Benz, 2005.
700
701       PIO data out security commands by Leonard den Ottolander , 2005.   Some
702       other parts by Benjamin Benz and others.
703

SEE ALSO

705       http://www.t13.org/  Technical  Committee T13 AT Attachment (ATA/ATAPI)
706       Interface.
707
708       http://www.serialata.org/ Serial ATA International Organization.
709
710       http://www.compactflash.org/ CompactFlash Association
711
712
713
714Version 9.27                    September 2009                       HDPARM(8)
Impressum