When you install a new hard drive, plug in a USB flash drive, or attempt to resize your operating system’s storage, you must first understand how Linux “sees” your physical disks. Unlike Windows, which abstracts drives into simple letters (C:, D:), Linux treats everything as a file, placing hardware devices inside the /dev directory. Understanding this structure can be intimidating for beginners. Fortunately, the lsblk (List Block Devices) command provides a highly visual, easy-to-read tree diagram of all your storage devices and how they are partitioned.
The Basic lsblk Command
The lsblk command is incredibly safe to use because it is strictly read-only. It only queries the system for information; it cannot format or delete your data.
To view your connected drives, open your terminal and type:
lsblk
Press Enter.
Understanding the Output Structure
The command will output a table. The genius of lsblk is that it uses visual indentation (a tree-like structure) to show relationships between physical disks and their internal partitions.
- NAME: The first column shows the device identifier.
- sdX (e.g., sda, sdb, sdc): These usually represent SATA hard drives or USB sticks.
sdais the first drive,sdbis the second, and so on. - nvme0n1: This represents a modern, high-speed NVMe solid-state drive.
- loopX: You can ignore these. Ubuntu uses “loop” devices to mount Snap packages (isolated software containers). They are not real physical disks.
- sdX (e.g., sda, sdb, sdc): These usually represent SATA hard drives or USB sticks.
- Partitions (The Indented Items): If you look under a physical disk like
sda, you will see indented entries like├─sda1and└─sda2. These are the partitions (the logical slices) created on that physical drive. - MAJ:MIN: The major and minor device numbers used internally by the Linux kernel.
- RM: Stands for Removable. A
0means the drive is internal/fixed. A1means it is removable (like a USB drive). - SIZE: The total storage capacity of the disk or partition.
- RO: Read-Only.
0means you can write data to it;1means it is locked. - TYPE: Tells you if the item is a physical
diskor a logicalpart(partition). - MOUNTPOINTS: This is crucial. It tells you where in your Linux file system that partition is currently accessible. If a partition has a mount point like
/(the root) or/home, it means it is actively being used by the operating system. If it is blank, the partition exists but is not currently mounted (like a newly plugged-in USB drive).
How to View File System Types (Filtering Output)
While the default lsblk output is great, it doesn’t tell you how the partitions are formatted (e.g., ext4, NTFS, FAT32). You can ask lsblk to display specific columns using the -f (filesystems) flag.
Type: lsblk -f
This alters the output, replacing the technical kernel numbers with highly useful information:
- FSTYPE: Shows the formatting (e.g.,
ext4for Linux,vfatfor EFI partitions,ntfsfor Windows drives). - UUID: The Universally Unique Identifier. This long string of characters is the permanent “name tag” for that partition, which is essential if you want to configure your system to automatically mount the drive when it boots up (by editing the
/etc/fstabfile).