hdparm
hdparm provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE device driver subsystem. Some options may work correctly only with the latest kernels. For best results, compile hdparm with the include files from the latest kernel source code.[1]
Documentation
- man 8 'hdparm' [EN]
Syntax
hdparm [PARAMETER ...] [DEVICE]
Parameters
- -d[0|1]
- 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 which are 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 drive itself 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 a difference, or may even slow things down (on really messed up hardware!). Your mileage may vary.
- -i
- Display the identification info that was obtained from the drive at boot time, if available. This is a feature of modern IDE drives, and may not be supported by older devices. The data returned may or may not be current, depending on activity since booting the system.
- -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.
- -m[SECTOR]
- 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 a feature of most modern IDE hard drives, permitting the transfer of multiple sectors per I/O interrupt, rather than the usual one sector per interrupt. When this feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%.
- -X[MODE]
- Set the IDE transfer MODE for newer (E)IDE/ATA drives. This is typically used in combination with -d1 when enabling DMA to/from a drive on a supported interface 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 UltraDMA beforehand).
Examples
- Enable DMA on /dev/hda
hdparm -d1 '/dev/hda'
References
- ↑ man 8 'hdparm'