A command-line utility for Linux that displays hard drive details including disk information, capacity, model, mount points, and SMART data (temperature, power-on hours, power cycle count).
Quick Install:
curl -fsSL https://raw.githubusercontent.com/cgons/hdinfo/master/install.sh | sudo bash
- List all system disks with model, capacity, interface type, and state
- View partition mount points with used/free space
- Retrieve SMART data: temperature, power-on hours, power cycle count
- Respects disk sleep states (won't wake sleeping disks unless forced)
hdinfo relies on the following system utilities that must be installed:
| Tool | Package | Purpose |
|---|---|---|
lsblk |
util-linux |
List block devices |
hdparm |
hdparm |
Query disk state (active/standby) |
smartctl |
smartmontools |
Read SMART attributes |
# Debian/Ubuntu
sudo apt install util-linux hdparm smartmontools
# Arch Linux
sudo pacman -S util-linux hdparm smartmontools
# Fedora/RHEL
sudo dnf install util-linux hdparm smartmontoolsNote:
hdinfois only supported on Linux based systems (no Windows or MacOS)hdinfohas only been tested on a Debian AMD64 system. If you encounter bugs on another Linux variant or architecture (ARM64), please report it
Requires Go 1.25+.
go install github.com/cgons/hdinfo/cmd/hdinfo@latestgit clone https://github.com/cgons/hdinfo.git
cd hdinfo
go build -o hdinfo ./cmd/hdinfoNote:
hdinforequires root privileges. All commands must be run withsudo.
| Flag | Description |
|---|---|
--no-color |
Disable colorized output |
List all system disks and their details.
sudo hdinfo disks [options]
Options:
| Flag | Alias | Description |
|---|---|---|
--smart-data |
Include SMART data (temperature, power-on hours, power cycle count) | |
--force |
Wake sleeping disks to fetch SMART data (requires --smart-data) |
|
--silent |
-s |
Suppress informational hints in the output |
--no-stats |
Hide disk statistics totals from output | |
--help |
-h |
Show help |
Examples:
# List all disks
sudo hdinfo disks
# Include SMART data (skips sleeping disks)
sudo hdinfo disks --smart-data
# Include SMART data and wake sleeping disks
sudo hdinfo disks --smart-data --force
# Silent mode (no hints)
sudo hdinfo disks -s --smart-data
# Disable colors (useful when piping to a file)
sudo hdinfo disks --no-colorSample output:
Name Model Capacity IsSSD Interface State
sda WDC WD100EMAZ-00 9.1T false sata active/idle
sdb WDC WD100EMAZ-00 9.1T false sata active/idle
nvme0 Samsung 990 Pro 1.8T true nvme active/idle
List disk partitions and their mount points with space usage.
sudo hdinfo mounts
Options:
| Flag | Alias | Description |
|---|---|---|
--help |
-h |
Show help |
Example:
sudo hdinfo mountsSample output:
Name Model MountPoint Capacity UsedSpace FreeSpace Used/Free
sda1 WDC WD100EMAZ-00 /mnt/data1 9.1T 4.5T 4.6T 50% / 50%
sdb1 WDC WD100EMAZ-00 /mnt/data2 9.1T 1.2T 7.9T 13% / 87%
nvme0p1 Samsung 990 Pro / 1.8T 200G 1.6T 11% / 89%
AI usage was limited to the following areas:
- README updates
- Generation of regex patterns to parse disk info
- Updates to colorized output
- Addition of conveniece flags (--no-color, --no-stats)