Storage Maintenance on Arch Linux
INFO
Learn how to check hard drive properties and health using hdparm and smartctl or configure trim on Arch Linux.
Installation
Install the required packages:
shellsudo pacman -S hdparm smartmontools
Package Info:
hdparm→ View and set hard drive parameters.smartmontools→ Monitor hard drive health using S.M.A.R.T.
Checking Hard Drive Properties with hdparm
- List all drives:shell
lsblk - Check basic drive information:shellReplace
sudo hdparm -I /dev/sdXsdXwith your actual drive (e.g.,sda).
TIP
Use sudo hdparm -tT /dev/sdX to test drive read speed.
Checking Drive Health with smartctl (Simple)
- Check if S.M.A.R.T is supported and enabled on your drive:shell
sudo smartctl -i /dev/sdX - Get an overall health summary:shell
sudo smartctl -H /dev/sdX
Checking Drive Health with smartctl (Advanced)
Check detailed S.M.A.R.T. data:
shellsudo smartctl -a /dev/sdXPerform a short self-test:
shellsudo smartctl -t short /dev/sdXINFO
You can also perform a
longself-test.View test results:
shellsudo smartctl -l selftest /dev/sdX
Enabling TRIM for SSDs
INFO
TRIM improves SSD longevity and speed by clearing unused data blocks.
IMPORTANT
The tool hdparm works for SATA drives but doesn't work well with NVMe drives.
- Check if your drive supports TRIM:shell
sudo hdparm -I /dev/sdX | grep TRIM - Manually run TRIM:shell
sudo fstrim -v / - Enable automatic TRIM:shell
sudo systemctl enable --now fstrim.timer
