Debian Codegraph @

upstream/fedora-44/man8/hdparm.8

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