Linux keeps its storage devices out of sight. No drive window pops up on its own, so you check disks from the terminal. Before you partition, format, or mount anything, you need to see what’s attached and how it’s labeled. The commands below cover that job, from a quick one-liner to a full partition map.
How Linux Names Disks and Partitions
Device names follow a fixed pattern. SATA and USB drives show up as /dev/sda, /dev/sdb, and so on. NVMe drives appear as /dev/nvme0n1.
Partitions on a drive carry a number after the name: /dev/sda1, /dev/sda2. Once you know the pattern, every command in this guide reads more clearly.
Use lsblk to List Disks in Linux
lsblk is where most people start. It prints block devices as a tree with size and mount point.
lsblk
Add the -f flag when you also want the filesystem type:
lsblk -f
| Column | What it shows |
|---|---|
| NAME | Device label such as sda, sda1, nvme0n1 |
| SIZE | Capacity of the device or partition |
| TYPE | Disk or partition |
| MOUNTPOINT | Where the device is mounted |
| FSTYPE | Filesystem type like ext4, xfs, or ntfs |
Basic output runs without root, which makes lsblk a low-risk way to list disks on any machine. It’s the command I reach for first when planning a dual-boot layout and I need to confirm which drive is which.
List Disk Partitions With fdisk
fdisk is a partition editor, but its list flag works fine for inspection.
sudo fdisk -l
This one needs root. It returns sector size, partition table type, and the start and end points of every partition. It says more than lsblk when you want partition-level precision.
To look at a single disk instead of the whole system:
sudo fdisk -l /dev/sda
Check Disk Space With df
df reports how much space is used and free on mounted filesystems. It won’t show unmounted drives, so treat it as a space check rather than a full inventory.
df -h
The -h flag prints sizes in GB and MB instead of raw block counts.
| Column | Meaning |
|---|---|
| Filesystem | Device or mount name |
| Size | Total capacity |
| Used | Space in use |
| Avail | Free space left |
| Use% | Percentage of capacity used |
| Mounted on | Directory path for the mount |
List Partition Tables With parted
parted reads both GPT and MBR partition tables and prints details for each one.
sudo parted -l
It lists every detected disk with its table type, size, and partitions. This matters on drives larger than 2 TB, where MBR runs out of room and GPT takes over. The same tool comes up often when you prepare a bootable USB drive and want to confirm the layout before writing an image.
Other Ways to List Disks and Partitions
The kernel keeps its own partition list at /proc/partitions. Read it directly:
cat /proc/partitions
The output shows major and minor device numbers, block count, and device name. It’s raw, but useful in scripts or when nothing else is installed.
blkid pulls the UUID, filesystem type, and label for each block device.
sudo blkid
UUIDs are the safer choice for /etc/fstab because device names can shuffle between reboots. They also show up when you work with disk encryption setups that map volumes by identifier.
Which Command Fits the Job
| Task | Command |
|---|---|
| Quick overview of all disks | lsblk |
| Full partition detail with sectors | sudo fdisk -l |
| Free space on mounted drives | df -h |
| Partition tables with GPT support | sudo parted -l |
| UUID and filesystem label | sudo blkid |
| Kernel partition list | cat /proc/partitions |
Confirm the device before any destructive step. Mixing up /dev/sda and /dev/sdb during a format wipes data you may not get back, so cross-check lsblk against fdisk -l first.
When a script handles disk tasks, file permissions come into play. The guide on how to make a script executable covers that, and scheduling regular backups protects you if a command goes to the wrong drive. Routine cleanup, like removing an old directory, is safer once you know exactly what’s mounted where.
FAQs
How do I list all disks in Linux?
Run lsblk for a tree view of every disk and partition, or sudo fdisk -l for detailed output with sector sizes and partition tables. lsblk needs no root for basic information.
What is the difference between lsblk and fdisk?
lsblk shows a quick tree of block devices, sizes, and mount points without root. fdisk -l adds sector sizes, partition table type, and exact start and end points, but it requires root access.
How do I see partitions on a specific disk?
Use sudo fdisk -l /dev/sda, replacing sda with your target drive. This limits the output to one disk and lists its partitions, sizes, and table type.
Which command shows free disk space?
df -h reports used and available space on mounted filesystems in human-readable units. It does not list unmounted drives, so pair it with lsblk for a full picture.
How do I find a partition UUID in Linux?
Run sudo blkid to list the UUID, filesystem type, and label for each device. UUIDs stay stable across reboots, which makes them reliable for /etc/fstab entries.