hdparm
Overview
The hdparm
command gets and sets SATA/IDE device parameters. It’s used to tune and configure hard disk parameters for optimal performance.
Syntax
hdparm [options] [device]
Common Options
Option | Description |
---|---|
-i |
Display drive identification |
-I |
Detailed drive info |
-t |
Perform device read timing |
-T |
Perform cache read timing |
-d |
Get/set using_dma flag |
-a |
Get/set fs readahead |
-A |
Get/set drive lookahead |
-W |
Get/set drive write-caching |
-S |
Set standby timeout |
-y |
Put drive in standby |
-Y |
Put drive to sleep |
-C |
Check power mode |
-B |
Get/set Advanced Power Management |
Key Use Cases
- Drive performance
- Power management
- Drive configuration
- Performance testing
- Troubleshooting
Examples with Explanations
Example 1: Drive Info
hdparm -I /dev/sda
Show detailed drive information
Example 2: Performance Test
hdparm -tT /dev/sda
Test drive reading speed
Example 3: Power Mode
hdparm -C /dev/sda
Check drive power mode
Common Usage Patterns
Enable DMA:
hdparm -d1 /dev/sda
Set standby:
hdparm -S 120 /dev/sda
Write cache:
hdparm -W1 /dev/sda
Security Considerations
- Root access required
- Data integrity
- System stability
- Power management
- Performance impact
Additional Resources
Best Practices
- Backup before changes
- Test settings
- Document changes
- Monitor performance
- Regular maintenance
Performance Tuning
- DMA settings
- Read-ahead
- Write caching
- Power management
- Access patterns
Troubleshooting
- Performance issues
- Power problems
- Configuration errors
- Compatibility
- Data corruption