hdparm [options] [device ...]
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. E.g. recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with the latest kernels.
When no options are given, -acdgkmur is assumed. For "Get/set" options, a query without the optional parameter (e.g. -d) will query (get) the device state, and with a parameter (e.g., -d0) will set the device state.
These switches are DANGEROUS to experiment with, and might not work with some kernels. USE AT YOUR OWN RISK.
THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.
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. Filesystem corruption may result. Backup everything before experimenting!
Some options (e.g. -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 SCSI hard 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 cases even panic. The security commands however might indeed have been executed by the drive. This poor kernel behaviour makes the PIO data security commands rather useless 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 locked drive 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 segfault it is often still possible to run two instances of hdparm consecutively and issue the two necessary commands that way.
hdparm has been written by Mark Lord <email@example.com>, the original primary developer and maintainer of the (E)IDE driver for Linux, and current contributor to the libata subsystem, along with suggestions and patches from many netfolk.
The disable Seagate auto-powersaving code is courtesy of Tomi Leppikangas(firstname.lastname@example.org).
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.
http://www.t13.org/ Technical Committee T13 AT Attachment (ATA/ATAPI) Interface.
http://www.serialata.org/ Serial ATA International Organization.
http://www.compactflash.org/ CompactFlash Association.