23-04-2021



hdparm
Developer(s)Mark Lord
Stable release
Operating systemLinux
Size134 kB
TypeUtility software
LicenseBSD license
Websitesourceforge.net/projects/hdparm/

Hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS 'libata' subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support 'SAT' (SCSI-ATA Command Translation) and therefore may also work with hdparm. Use HDParm to do this. Or if the SSD you purchased comes with a utility, the utility should have the secure erase option built in. Preparing your Mac for disposal (Catalina edition).

hdparm is a command line program for Linux to set and view ATAhard disk drive hardware parameters and test performance. It can set parameters such as drive caches, sleep mode, power management, acoustic management, and DMA settings. GParted and Parted Magic both include hdparm.[citation needed]

Changing hardware parameters from suboptimal conservative defaults to their optimal settings can improve performance greatly. For example, turning on DMA can, in some instances, double or triple data throughput. There is, however, no reliable method for determining the optimal settings for a given controller-drive combination, except careful trial and error.

hdparm has a serious drawback: With certain parameters, it can crash a computer and make data on its disk inaccessible. Several of the 67 parameters are dangerous and could result in massive filesystem corruption if used indiscriminately.

Usage examples[edit]

hdparm has to be run with special privileges, otherwise it will either not be found or the requested actions will not be executed properly.

Display information of the hard drive:[2]

Hdparm For Mac App

Turn on DMA for the first hard drive:

Test device read performance speed (-t for timing buffered disk reads) of the first hard drive:

Enable energy saving spindown after inactivity (24*5=120 seconds):

To retain hdparm settings after a software reset, run:

Enable read-ahead:

If the disk is constantly too noisy, you can change its acoustic management at the cost of read/write performance (Some drives, such as newer WD drives and all SSDs, ignore this setting.):


If the disk synchronisation intervals are too short, then even small amounts of data will be written to disk which can have severe consequences for its lifespan. The better way would be to collect small data into bigger chunks and wait until the chunk is big enough to be written to disk.

Current web browsers like Chrome write regularly small chunks when browsing in order not to lose any important data when the application crashes. However, this lets the disk spin very often as the drive repeatedly needs to unleash and then park its heads. The generated noises can be thus regarded as distracting by the user. To circumvent this issue, you can switch the drive to the lowest degree of power management (next value, 255, turns power management off):[3]

Additionally, changing the value of /proc/sys/vm/dirty_expire_centisecs can have an effect on the performance. It sets the flush interval when dirty pages are written to disk.[4]

Note that all these commands are only effective in the long-run, if you make the changes persistent. However, the settings you can set via hdparm are reverted each time you reboot. Therefore, it might be wise to restore the personal settings upon boot. An appropriate place that exists in most Linux distributions is the /etc/rc.local script.

References[edit]

  1. ^hdparm / News
  2. ^'Tuning hard drive'.
  3. ^'ThinkWiki.org'.
  4. ^'Documentation for /proc/sys/vm/*'.

See also[edit]

  • ATATool for Windows

External links[edit]

  • hdparm on SourceForge.net
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Hdparm&oldid=920724277'

Name

hdparm - get/set SATA/IDE device parameters

Synopsis

hdparm [ flags ] [device] ..

Description

hdparm provides a command line interface to various kernel interfaces supported by theLinux SATA/PATA/SAS 'libata' subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support 'SAT' (SCSI-ATACommand Translation) and therefore may also work with hdparm. Eg. recent WD 'Passport' models and recent NexStar-3 enclosures. Some options may work correctlyonly with the latest kernels.

Options

When no flags are given, -acdgkmur is assumed. For Get/Set options, a query without anoptional parameter (e.g. -d) will query (get) the device state, and with a parameter (e.g., -d0) will set the device state.
-A0 (disable) or -A1 (enable).
-b
Get/set bus state.
-B
Query/set Advanced Power Management feature, if the drive supports it. A low value means aggressive power management and a high value means betterperformance. Possible settings range from values 1 through 127 (which permit spin-down), and values 128 through 254 (which do not permit spin-down). Thehighest degree of power management is attained with a setting of 1, and the highest I/O performance with a setting of 254. A value of 255 tells hdparm todisable Advanced Power Management altogether on the drive (not all drives support disabling it, but most do).
-c
Query/enable (E)IDE 32-bit I/O support. A numeric parameter can be used to enable/disable 32-bit I/O support: Currently supported values include 0to disable 32-bit I/O support, 1 to enable 32-bit data transfers, and 3 to enable 32-bit data transfers with a special sync sequencerequired by many chipsets. The value 3 works with nearly all 32-bit IDE chipsets, but incurs slightly more overhead. Note that '32-bit' refers to datatransfers across a PCI or VLB bus to the interface card only; all (E)IDE drives still have only a 16-bit connection over the ribbon cable from the interfacecard.
-C
Check the current IDE power mode status, which will always be one of unknown (drive does not support this command), active/idle (normaloperation), standby (low power mode, drive has spun down), or sleeping (lowest power mode, drive is completely shut down). The -S, -y, -Y,and -Z flags can be used to manipulate the IDE power modes.
-d
Disable/enable the 'using_dma' flag for this drive. This option now works with most combinations of drives and PCI interfaces which support DMA and whichare known to the kernel IDE driver. It is also a good idea to use the appropriate -X option in combination with -d1 to ensure that the driveitself is programmed for the correct DMA mode, although most BIOSs should do this for you at boot time. Using DMA nearly always gives the best performance,with fast I/O throughput and low CPU usage. But there are at least a few configurations of chipsets and drives for which DMA does not make much of adifference, or may even slow things down (on really messed up hardware!). Your mileage may vary.
--dco-freeze
DCO stands for Device Configuration Overlay, a way for vendors to selectively disable certain features of a drive. The --dco-freeze flag willfreeze/lock the current drive configuration, thereby preventing software (or malware) from changing any DCO settings until after the next power-on reset.
--dco-identify
Query and dump information regarding drive configuration settings which can be disabled by the vendor or OEM installer. These settings show capabilities ofthe drive which might be disabled by the vendor for 'enhanced compatibility'. When disabled, they are otherwise hidden and will not show in the -Iidentify output. For example, system vendors sometimes disable 48_bit addressing on large drives, for compatibility (and loss of capacity) with a specificBIOS. In such cases, --dco-identify will show that the drive is 48_bit capable, but -I will not show it, and nor will the drive accept 48_bitcommands.
--dco-restore
Reset all drive settings, features, and accessible capacities back to factory defaults and full capabilities. This command will fail if DCO isfrozen/locked, or if a -Np maximum size restriction has also been set. This is EXTREMELY DANGEROUS and will very likely cause massive loss ofdata. DO NOT USE THIS COMMAND.
--direct
Use the kernel O_DIRECT flag when performing a -t timing test. This bypasses the page cache, causing the reads to go directly from the drive intohdparm's buffers, using so-called 'raw' I/O. In many cases, this can produce results that appear much faster than the usual page cache method, giving a betterindication of raw device and driver performance.
--drq-hsm-error
VERY DANGEROUS, DON'T EVEN THINK ABOUT USING IT. This flag causes hdparm to issue an IDENTIFY command to the kernel, but incorrectly marked as a'non-data' command. This results in the drive being left with its DataReQust(DRQ) line 'stuck' high. This confuses the kernel drivers, and may crash the systemimmediately with massive data loss. The option exists to help in testing and fortifying the kernel against similar real-world drive malfunctions. VERYDANGEROUS, DO NOT USE!!
-D
Enable/disable the on-drive defect management feature, whereby the drive firmware tries to automatically manage defective sectors by relocating them to'spare' sectors reserved by the factory for such. Control of this feature via the -D flag is not supported for most modern drives since ATA-4; thus thiscommand may fail.
-E
Set cd/dvd drive speed. This is NOT necessary for regular operation, as the drive will automatically switch speeds on its own. But if you want to play withit, just supply a speed number after the option, usually a number like 2 or 4.
-f
Sync and flush the buffer cache for the device on exit. This operation is also performed internally as part of the -t and -T timings andother flags.
--fibmap
When used, this must be the only flag given. It requires a file path as a parameter, and will print out a list of the device extents (sector ranges)occupied by that file on disk. Sector numbers are given as absolute LBA numbers, referenced from sector 0 of the physical device (*not* the partition orfilesystem). This information can then be used for a variety of purposes, such as examining the degree of fragmenation of larger files, or determiningappropriate sectors to deliberately corrupt during fault-injection testing procedures.
--fibmap-sector
When used, this must be the only flag given. It requires a file path followed by a sector number as parameters. This sector number is given relative to thestart of the file itself, not the device. hdparm will scan the device extents occupied by the file, and print out the absolute LBA number of the requestedsector of the file. This LBA number is referenced from sector 0 of the physical device (not the partition or filesystem). This LBA value can then be used for avariety of purposes, including determining an appropriate sector to deliberately corrupt during fault-injection testing procedures.
--fwdownload
When used, this should be the only flag given. It requires a file path immediately after the flag, indicating where the new drive firmware should be readfrom. The contents of this file will be sent to the drive using the (S)ATA DOWNLOAD MICROCODE command, using either transfer protocol 7 (entire file atonce), or, if the drive supports it, transfer protocol 3 (segmented download). This command is EXTREMELY DANGEROUS and could destroy both the drive andall data on it. DO NOT USE THIS COMMAND. The --fwdownload-mode3 , --fwdownload-mode3-max , and --fwdownload-mode7 variations onbasic --fwdownload allow overriding automatic protocol detection in favour of forcing hdparm to use a specific transfer protocol, for testing purposesonly.
-F
Flush the on-drive write cache buffer (older drives may not implement this).
-g
Display the drive geometry (cylinders, heads, sectors), the size (in sectors) of the device, and the starting offset (in sectors) of the device from thebeginning of the drive.
-h
Display terse usage information (help).
-i
Display the identification info which the kernel drivers (IDE, libata) have stored from boot/configuration time. This may differ from the currentinformation obtainable directly from the drive itself with the -I flag. The data returned may or may not be current, depending on activity since bootingthe system. For a more detailed interpretation of the identification info, refer to AT Attachment Interface for Disk Drives, ANSI ASC X3T9.2 workingdraft, revision 4a, April 19/93, and later editions.
-I
Request identification info directly from the drive, which is displayed in a new expanded format with considerably more detail than with the older-i flag.
--idle-immediate
Issue an ATA IDLE_IMMEDIATE command, to put the drive into a lower power state. Usually the device remains spun-up.
--idle-unload
Issue an ATA IDLE_IMMEDIATE_WITH_UNLOAD command, to unload or park the heads and put the drive into a lower power state. Usually the device remainsspun-up.
--Istdin
This is a special variation on the -I option, which accepts a drive identification block as standard input instead of using a /dev/hd* parameter.The format of this block must be exactly the same as that found in the /proc/ide/*/hd*/identify 'files', or that produced by the --Istdout optiondescribed below. This variation is designed for use with collected 'libraries' of drive identification information, and can also be used on ATAPI drives whichmay give media errors with the standard mechanism. When --Istdin is used, it must be the *only* parameter given.
--Istdout
This option dumps the drive's identify data in hex to stdout, in a format similar to that from /proc/ide/*/identify, and suitable for later use with the--Istdin option.
-k
Get/set the keep_settings_over_reset flag for the drive. When this flag is set, the driver will preserve the -dmu options over a soft reset, (asdone during the error recovery sequence). This flag defaults to off, to prevent drive reset loops which could be caused by combinations of -dmusettings. The -k flag should therefore only be set after one has achieved confidence in correct system operation with a chosen set of configurationsettings. In practice, all that is typically necessary to test a configuration (prior to using -k) is to verify that the drive can be read/written, and that noerror logs (kernel messages) are generated in the process (look in /var/adm/messages on most systems).
-K
Set the drive's keep_features_over_reset flag. Setting this enables the drive to retain the settings for -APSWXZ over a soft reset (as done duringthe error recovery sequence). Not all drives support this feature.
-L
Set the drive's doorlock flag. Setting this to 1 will lock the door mechanism of some removable hard drives (eg. Syquest, ZIP, Jazz..), and settingit to 0 will unlock the door mechanism. Normally, Linux maintains the door locking mechanism automatically, depending on drive usage (locked whenever afilesystem is mounted). But on system shutdown, this can be a nuisance if the root partition is on a removable disk, since the root partition is left mounted(read-only) after shutdown. So, by using this command to unlock the door after the root filesystem is remounted read-only, one can then remove thecartridge from the drive after shutdown.
-m
Get/set sector count for multiple sector I/O on the drive. A setting of 0 disables this feature. Multiple sector mode (aka IDE Block Mode), is afeature of most modern IDE hard drives, permitting the transfer of multiple sectors per I/O interrupt, rather than the usual one sector per interrupt. Whenthis feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%. On many systems, it also provides increased data throughput ofanywhere from 5% to 50%. Some drives, however (most notably the WD Caviar series), seem to run slower with multiple mode enabled. Your mileage may vary. Mostdrives support the minimum settings of 2, 4, 8, or 16 (sectors). Larger settings may also be possible, depending on the drive. A setting of 16 or 32 seemsoptimal on many systems. Western Digital recommends lower settings of 4 to 8 on many of their drives, due tiny (32kB) drive buffers and non-optimized bufferingalgorithms. The -i flag can be used to find the maximum setting supported by an installed drive (look for MaxMultSect in the output). Some drives claimto support multiple mode, but lose data at some settings. Under rare circumstances, such failures can result in massive filesystem corruption.
--make-bad-sector
Deliberately create a bad sector (aka. 'media error') on the disk. EXCEPTIONALLY DANGEROUS. DO NOT USE THIS FLAG!! This can be useful for testing ofdevice/RAID error recovery mechanisms. The sector number is given as a (base10) parameter after the flag. Depending on the device, hdparm will choose one oftwo possible ATA commands for corrupting the sector. The WRITE_LONG works on most drives, but only up to the 28-bit sector boundary. Some very recent drives(2008) may support the new WRITE_UNCORRECTABLE_EXT command, which works for any LBA48 sector. If available, hdparm will use that in preference to WRITE_LONG.The WRITE_UNCORRECTABLE_EXT command itself presents a choice of how the new bad sector should behave. By default, it will look like any other bad sector, andthe drive may take some time to retry and fail on subsequent READs of the sector. However, if a single letter f is prepended immediately in front of thefirst digit of the sector number parameter, then hdparm will issue a 'flagged' WRITE_UNCORRECTABLE_EXT, which causes the drive to merely flag the sector as bad(rather than genuinely corrupt it), and subsequent READs of the sector will fail immediately (rather than after several retries). Note also that the--repair-sector flag can be used to restore (any) bad sectors when they are no longer needed, including sectors that were genuinely bad (the drive willlikely remap those to a fresh area on the media).
-M
Get/set Automatic Acoustic Management (AAM) setting. Most modern harddisk drives have the ability to speed down the head movements to reduce their noiseoutput. The possible values are between 0 and 254. 128 is the most quiet (and therefore slowest) setting and 254 the fastest (and loudest). Some drives haveonly two levels (quiet / fast), while others may have different levels between 128 and 254. At the moment, most drives only support 3 options, off, quiet, andfast. These have been assigned the values 0, 128, and 254 at present, respectively, but integer space has been incorporated for future expansion, should thischange.
-N
Get/set max visible number of sectors, also known as the Host Protected Area setting. Without a parameter, -N displays the current setting,which is reported as two values: the first gives the current max sectors setting, and the second shows the native (real) hardware limit for the disk. Thedifference between these two values indicates how many sectors of the disk are currently hidden from the operating system, in the form of a Host ProtectedArea (HPA). This area is often used by computer makers to hold diagnostic software, and/or a copy of the originally provided operating system for recoverypurposes. To change the current max (VERY DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a new value should be provided (in base10) immediately following the-N flag. This value is specified as a count of sectors, rather than the 'max sector address' of the drive. Drives have the concept of a temporary(volatile) setting which is lost on the next hardware reset, as well as a more permanent (non-volatile) value which survives resets and power cycles. Bydefault, -N affects only the temporary (volatile) setting. To change the permanent (non-volatile) value, prepend a leading p characterimmediately before the first digit of the value. Drives are supposed to allow only a single permanent change per session. A hardware reset (or power cycle) isrequired before another permanent -N operation can succeed. Note that any attempt to set this value may fail if the disk is being accessed by othersoftware at the same time. This is because setting the value requires a pair of back-to-back drive commands, but there is no way to prevent some other commandfrom being inserted between them by the kernel. So if it fails initially, just try again. Kernel support for -N is buggy for many adapter types acrossmany kernel versions, in that an incorrect (too small) max size value is sometimes reported. As of the 2.6.27 kernel, this does finally seem to be working onmost hardware.
-n
Get or set the 'ignore write errors' flag in the driver. Do NOT play with this without grokking the driver source code first.
-p
Attempt to reprogram the IDE interface chipset for the specified PIO mode, or attempt to auto-tune for the 'best' PIO mode supported by the drive. Thisfeature is supported in the kernel for only a few 'known' chipsets, and even then the support is iffy at best. Some IDE chipsets are unable to alter the PIOmode for a single drive, in which case this flag may cause the PIO mode for both drives to be set. Many IDE chipsets support either fewer or more thanthe standard six (0 to 5) PIO modes, so the exact speed setting that is actually implemented will vary by chipset/driver sophistication. Use withextreme caution! This feature includes zero protection for the unwary, and an unsuccessful outcome may result in severe filesystem corruption!
-P
Set the maximum sector count for the drive's internal prefetch mechanism. Not all drives support this feature, and it was dropped from the offical spec asof ATA-4.
--prefer-ata12
When using the SAT (SCSI ATA Translation) protocol, hdparm normally prefers to use the 16-byte command format whenever possible. But some USB driveenclosures don't work correctly with 16-byte commands. This flag can be used to force use of the smaller 12-byte command format with such drives. hdparm willstill revert to 16-byte commands for things that cannot be done with the 12-byte format (eg. sector accesses beyond 28-bits).
-q
Handle the next flag quietly, suppressing normal output (but not error messages). This is useful for reducing screen clutter when running from systemstartup scripts. Not applicable to the -i or -v or -t or -T flags.
-Q
Get or set the device's command queue_depth, if supported by the hardware. This only works with 2.6.xx (or later) kernels, and only with device and drivercombinations which support changing the queue_depth. For SATA disks, this is the Native Command Queuing (NCQ) queue depth.
-r
Get/set read-only flag for the device. When set, Linux disallows write operations on the device.
--read-sector
Reads from the specified sector number, and dumps the contents in hex to standard output. The sector number must be given (base10) after this flag. hdparmwill issue a low-level read (completely bypassing the usual block layer read/write mechanisms) for the specified sector. This can be used to definitively checkwhether a given sector is bad (media error) or not (doing so through the usual mechanisms can sometimes give false positives).
--repair-sector
This is an alias for the --write-sector flag. VERY DANGEROUS.
-R
Register an IDE interface (DANGEROUS). See the -U option for more information.
-s
Enable/disable the power-on in standby feature, if supported by the drive. VERY DANGEROUS. Do not use unless you are absolutely certain that boththe system BIOS (or firmware) and the operating system kernel (Linux >= 2.6.22) support probing for drives that use this feature. When enabled, the drive ispowered-up in the standby mode to allow the controller to sequence the spin-up of devices, reducing the instantaneous current draw burden when manydrives share a power supply. Primarily for use in large RAID setups. This feature is usually disabled and the drive is powered-up in the active mode(see -C above). Note that a drive may also allow enabling this feature by a jumper. Some SATA drives support the control of this feature by pin 11 of the SATApower connector. In these cases, this command may be unsupported or may have no effect.
-S
Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive. This timeout value is used by the drive to determinehow long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 secondsto respond to a subsequent disk access, though most drives are much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means'timeouts are disabled': the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 isinterpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.
-T
Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwiseinactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linuxbuffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test.
-t
Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwiseinactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache tothe disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without anyfilesystem overhead. To ensure accurate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl.
--trim-sectors
For Solid State Drives (SSDs). EXCEPTIONALLY DANGEROUS. DO NOT USE THIS FLAG!! Tells the drive firmware to discard unneeded data sectors, destroyingany data that may have been present within them. This makes those sectors available for immediate use by the firmware's garbage collection mechanism, toimprove scheduling for wear-leveling of the flash media. This option expects two parameters immediately after the flag: an LBA starting address, and a sectorcount. EXCEPTIONALLY DANGEROUS. DO NOT USE THIS FLAG!!
-u
Get/set interrupt-unmask flag for the drive. A setting of 1 permits the driver to unmask other interrupts during processing of a disk interrupt,which greatly improves Linux's responsiveness and eliminates 'serial port overrun' errors. Use this feature with caution: some drive/controllercombinations do not tolerate the increased I/O latencies possible when this feature is enabled, resulting in massive filesystem corruption. Inparticular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable (due to a hardware flaw) when this option is used with kernel versionsearlier than 2.0.13. Disabling the IDE prefetch feature of these interfaces (usually a BIOS/CMOS setting) provides a safe fix for the problem for usewith earlier kernels.
-U
Un-register an IDE interface (DANGEROUS). The companion for the -R option. Intended for use with hardware made specifically for hot-swapping(very rare!). Use with knowledge and extreme caution as this can easily hang or damage your system. The hdparm source distribution includes a 'contrib'directory with some user-donated scripts for hot-swapping on the UltraBay of a ThinkPad 600E. Use at your own risk.
-v
Display some basic settings, similar to -acdgkmur for IDE. This is also the default behaviour when no flags are specified.
--verbose
Display extra diagnostics from some commands.
-w
Perform a device reset (DANGEROUS). Do NOT use this option. It exists for unlikely situations where a reboot might otherwise be required to get aconfused drive back into a useable state.
--write-sector
Writes zeros to the specified sector number. VERY DANGEROUS. The sector number must be given (base10) after this flag. hdparm will issue a low-level write(completely bypassing the usual block layer read/write mechanisms) to the specified sector. This can be used to force a drive to repair a bad sector (mediaerror).
-W
Get/set the IDE/SATA drive's write-caching feature.
-x
Tristate device for hotswap (DANGEROUS).
-X
Set the IDE transfer mode for (E)IDE/ATA drives. This is typically used in combination with -d1 when enabling DMA to/from a drive on a supportedinterface chipset, where -X mdma2 is used to select multiword DMA mode2 transfers and -X sdma1 is used to select simple mode 1 DMA transfers.With systems which support UltraDMA burst timings, -X udma2 is used to select UltraDMA mode2 transfers (you'll need to prepare the chipset for UltraDMAbeforehand). Apart from that, use of this flag is seldom necessary since most/all modern IDE drives default to their fastest PIO transfer mode atpower-on. Fiddling with this can be both needless and risky. On drives which support alternate transfer modes, -X can be used to switch the mode of thedrive only. Prior to changing the transfer mode, the IDE interface should be jumpered or programmed (see -p flag) for the new mode setting toprevent loss and/or corruption of data. Use this with extreme caution! For the PIO (Programmed Input/Output) transfer modes used by Linux, this value issimply the desired PIO mode number plus 8. Thus, a value of 09 sets PIO mode1, 10 enables PIO mode2, and 11 selects PIO mode3. Setting 00 restores the drive's'default' PIO mode, and 01 disables IORDY. For multiword DMA, the value used is the desired DMA mode number plus 32. for UltraDMA, the value is the desiredUltraDMA mode number plus 64.
-y
Force an IDE drive to immediately enter the low power consumption standby mode, usually causing it to spin down. The current power mode status canbe checked using the -C flag.
-Y
Force an IDE drive to immediately enter the lowest power consumption sleep mode, causing it to shut down completely. A hard or soft reset isrequired before the drive can be accessed again (the Linux IDE driver will automatically handle issuing a reset if/when needed). The current power mode statuscan be checked using the -C flag.
-z
Force a kernel re-read of the partition table of the specified device(s).
-Z
Disable the automatic power-saving function of certain Seagate drives (ST3xxx models?), to prevent them from idling/spinning-down at inconvenient times.
-H
Read the temperature from some (mostly Hitachi) drives. Also reports if the temperature is within operating condition range (this may not be reliable).Does not cause the drive to spin up if idle.

ATA Security Feature Set

Mac
These switches are
DANGEROUS to experiment with, and might not work with every kernel. USE AT YOUR OWN RISK.
--security-help
Display terse usage info for all of the --security-* flags.
--security-freeze
Freeze the drive's security settings. The drive does not accept any security commands until next power-on reset. Use this function in combination with--security-unlock to protect drive from any attempt to set a new password. Can be used standalone, too. No other flags are permitted on the command line withthis one.
--security-unlock PWD
Unlock the drive, using password PWD. Password is given as an ASCII string and is padded with NULs to reach 32 bytes. The applicable drive password isselected with the --user-master switch. No other flags are permitted on the command line with this one. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED.USE AT YOUR OWN RISK.
--security-set-pass PWD
Hdparm For Mac
Lock the drive, using password PWD (Set Password) (DANGEROUS). Password is given as an ASCII string and is padded with NULs to reach 32 bytes. Usethe special password NULL to set an empty password. The applicable drive password is selected with the --user-master switch and the applicable securitymode with the --security-mode switch. No other flags are permitted on the command line with this one. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USEAT YOUR OWN RISK.
--security-disable PWD
Disable drive locking, using password PWD. Password is given as an ASCII string and is padded with NULs to reach 32 bytes. The applicable drive password isselected with the --user-master switch. No other flags are permitted on the command line with this one. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED.USE AT YOUR OWN RISK.
--security-erase PWD
Erase (locked) drive, using password PWD (DANGEROUS). Password is given as an ASCII string and is padded with NULs to reach 32 bytes. Use thespecial password NULL to represent an empty password. The applicable drive password is selected with the --user-master switch. No other flags arepermitted on the command line with this one. THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.
--security-erase-enhanced PWD
Enhanced erase (locked) drive, using password PWD (DANGEROUS). Password is given as an ASCII string and is padded with NULs to reach 32 bytes. Theapplicable drive password is selected with the --user-master switch. No other flags are permitted on the command line with this one. THIS FEATURE ISEXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.
--user-master USER
Specifies which password (user/master) to select. Defaults to master. Only useful in combination with --security-unlock, --security-set-pass,--security-disable, --security-erase or --security-erase-enhanced. u user password
m master password

THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.

Hdparm For Mac
--security-mode MODE
Specifies which security mode (high/maximum) to set. Defaults to high. Only useful in combination with --security-set-pass. h high security
m maximum security

THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.

Files

/etc/hdparm.conf

Bugs

As noted above, the -m sectcount and -u 1 options should be used with caution at first,preferably on a read-only filesystem. Most drives work well with these features, but a few drive/controller combinations are not 100% compatible. Filesystemcorruption may result. Backup everything before experimenting!

Some options (eg. -r for SCSI) may not work with old kernels as necessary ioctl()'s were not supported.

Although this utility is intended primarily for use with SATA/IDE hard disk devices, several of the options are also valid (and permitted) for use with SCSIhard disk devices and MFM/RLL hard disks with XT interfaces.

The Linux kernel up until 2.6.12 (and probably later) doesn't handle the security unlock and disable commands gracefully and will segfault and in some caseseven panic. The security commands however might indeed have been executed by the drive. This poor kernel behaviour makes the PIO data security commands ratheruseless at the moment.

Note that the 'security erase' and 'security disable' commands have been implemented as two consecutive PIO data commands and will not succeed on a lockeddrive because the second command will not be issued after the segfault. See the code for hints how patch it to work around this problem. Despite the segfaultit is often still possible to run two instances of hdparm consecutively and issue the two necessary commands that way.

Author

hdparm has been written by Mark Lord <mlord@pobox.com>, the original primary developerand maintainer of the (E)IDE driver for Linux, and current contributer to the libata subsystem, along with suggestions and patches from many netfolk.

The disable Seagate auto-powersaving code is courtesy of Tomi Leppikangas(tomilepp@paju.oulu.fi).

Security freeze command by Benjamin Benz, 2005.

PIO data out security commands by Leonard den Ottolander , 2005. Some other parts by Benjamin Benz and others.

See Also

http://www.t13.org/ Technical Committee T13 AT Attachment (ATA/ATAPI) Interface.

Hdparm For Mac Download

http://www.serialata.org/ Serial ATA International Organization.

http://www.compactflash.org/ CompactFlash Association

Referenced By

apmd(8),cpudynd(8),fsync(2),hotswap(1),laptop-mode.conf(8),longrun(1),proc(5),sg_format(8),sg_inq(8)