Top Linux Partition Commands Explained Simply

x32x01
  • by x32x01 ||
Managing and monitoring your storage devices is an essential skill for every Linux user. Whether you’re fixing errors, creating new partitions, or just curious about your system setup, Linux gives you many built-in commands to get the job done. 🧠

In this guide, you’ll learn the top commands to view partitions, file systems, and disk usage on Linux - with simple examples for each one.

⚙️ 1. fdisk - The Classic Partition Tool​

fdisk is the most common command for listing disk partitions. It displays partition tables, file system types, and device information.
Code:
sudo fdisk -l

✅ Output includes:
  • Disk size
  • Sector size
  • File system type
  • Boot flag

👉 Example:
Code:
/dev/sda1   *  63 146801969  73400953+  7  HPFS/NTFS/exFAT
/dev/sda6     351614718 556427339 102406311 83  Linux
⚡ Tip: fdisk won’t show partition sizes in human-readable format - use sfdisk for that.



📏 2. sfdisk - Show Partition Sizes in MB​

sfdisk is like fdisk, but more detailed. It lists partition sizes in MB for easier reading.
Code:
sudo sfdisk -l -uM
You’ll see both logical and extended partitions, with clear size info and system type. Perfect for analyzing disk layouts.



🧭 3. cfdisk - Interactive Terminal Tool​

Want a more user-friendly interface? Use cfdisk. It’s an ncurses-based partition editor that lets you view, create, or delete partitions interactively.
Code:
sudo cfdisk /dev/sdb
🔹 Great for users who prefer visual navigation inside the terminal.



🧩 4. parted - Modern Disk Partition Utility​

parted works with modern disk formats and gives clear, organized output.
Code:
sudo parted -l

✅ Example Output:
Code:
Model: ATA ST3500418AS (scsi)
Disk /dev/sda: 500GB
Partition Table: msdos
1  32.3kB  75.2GB  ntfs  boot
2  75.2GB  500GB   ext4
💡 Use parted when working with large disks or GPT partitions.



📊 5. df - Show Mounted File Systems​

df (disk free) isn’t a partitioning tool, but it’s perfect for checking mounted file systems and available space.
Code:
df -h

To see only physical partitions:
Code:
df -h | grep ^/dev

Or use:
Code:
df -h --output=source,fstype,size,used,avail,pcent,target -x tmpfs -x devtmpfs
This filters out temporary systems and gives you clear, readable stats.



🐍 6. pydf - Colorful Disk Usage Display​

pydf is a Python version of df with better formatting and colored bars 📊.
Code:
pydf
It shows all mounted partitions with total, used, and available space in an easy-to-read format.



💾 7. lsblk - List Block Devices Clearly​

lsblk lists all storage blocks, including disks, partitions, and optical drives.
Code:
lsblk

✅ Output:
Code:
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk
├─sda6   8:6    0  97.7G  0 part /
└─sda8   8:8    0 198.5G  0 part /media/data

Show more info (UUIDs and model names):
Code:
lsblk -o PATH,SIZE,TYPE,MOUNTPOINT,UUID,MODEL
🚀 Best all-in-one command for quick storage overviews.



🔍 8. blkid - Display UUIDs and File System Types​

Use blkid to print device attributes like UUID, label, and file system type.
Code:
sudo blkid

Example:
Code:
/dev/sda6: UUID="6fa5a72a-ba26-4588" TYPE="ext4"
/dev/sdb1: UUID="08D1-8024" TYPE="vfat"
Great for mounting drives manually or editing /etc/fstab.



🧠 9. hwinfo - Hardware Information Tool​

hwinfo gives a summary of disks and partitions, showing hardware details instead of usage data.
Code:
hwinfo --block --short

Output includes disk models and partitions:
Code:
/dev/sda  ST3500418AS
/dev/sdb  Sony Storage Media
/dev/sda1 Partition



⚡ 10. inxi - Full Disk Overview​

inxi is a versatile command that provides deep insight into your system hardware.
Code:
inxi -D -xx

Example:
Code:
Drives:
ID-1: /dev/sda  SSD 120GB
ID-2: /dev/sdb  SSD 850 EVO 120GB
ID-3: /dev/sdc  USB SSD T5 465GB
💡 Add -x for extra details like disk speed and vendor.



🏁 Final Thoughts​

Linux gives you many tools to monitor, manage, and analyze your storage devices.
  • Use fdisk/sfdisk/parted for partition management.
  • Use df/pydf for checking space usage.
  • Use lsblk/blkid/inxi for complete hardware info.
🧩 Combine them to get a full picture of your system’s disks and partitions like a true Linux pro! 💪🐧
 
Last edited: