When you’re managing a Linux system, knowing your disk inside and out is essential. Whether you’re troubleshooting performance issues, planning for expansion, or just getting a feel for your system, you’ll need the right tools to gather detailed disk information.
Here’s a practical guide to getting a full picture of your disk setup on Linux, using commands that are built-in or easily installable.
1. Check Disk Space Usage with df
The df
command gives you a summary of disk space usage by mounted filesystems.
df -h
-h
: Human-readable (displays sizes in KB, MB, GB).- Shows total, used, and available space.
Example Output:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 20G 28G 42% /
2. Detailed Disk Partition Info with lsblk
lsblk
lists all block devices and their partitions in a tree structure.
lsblk -f
- Adds filesystem info like type and UUID.
- Great for identifying mount points and relationships between drives.
3. Inspect Disk Health and SMART Data with smartctl
Install smartmontools
to access SMART (Self-Monitoring, Analysis, and Reporting Technology) data:
sudo apt install smartmontools # Debian/Ubuntu
sudo smartctl -a /dev/sdX
Replace /dev/sdX
with your actual device (e.g. /dev/sda
).
This gives you:
- Temperature
- Power-on hours
- Reallocated sectors
- Failing attributes (if any)
4. Low-Level Disk Info with fdisk
or parted
For partition table and sector-level info:
sudo fdisk -l
or
sudo parted -l
These commands show:
- Disk model and size
- Partition table type (MBR/GPT)
- Sector size
- Partition layout
5. Get Filesystem Usage with du
To drill down and see which directories use the most space:
du -sh /*
-s
: Summary only.-h
: Human-readable.
For deeper inspection:
du -ah /path/to/directory | sort -rh | head -n 20
This shows the top 20 largest files and folders.
6. Use lsblk
+ blkid
+ mount
for a Full Picture
These three in combination help you see how everything ties together.
lsblk
blkid
mount | grep ^/dev
You’ll see:
- Block devices
- UUIDs and filesystem types
- What’s currently mounted and where
7. Disk I/O Performance with iostat
(from sysstat
)
To see how busy your disks are:
sudo apt install sysstat
iostat -xz 1 5
This shows:
- Read/write throughput
- % utilization
- Queue sizes
Helps diagnose slow disks or high I/O load.
Wrap-Up
Getting a clear view of your disks on Linux isn’t hard—it just takes the right mix of tools. These commands give you the technical insight to monitor, maintain, and troubleshoot your storage confidently. Bookmark this post and use it as your go-to reference whenever you need to check what’s going on under the hood.
Got other tools or tips you use for disk analysis? Drop them in the comments below.
Leave a Reply