lsblk and block devices
lsblk lists block devices such as disks, partitions, LVM volumes and loop devices as a tree, with their size, type and mount point. It is the safest first step before partitioning, formatting or mounting, because it shows which device is which.
1Reading the tree
Disks appear as sda, nvme0n1 or vda, and their partitions below them (sda1, nvme0n1p1). TYPE shows disk, part, lvm or loop; MOUNTPOINTS shows where each is mounted.
2Useful options
lsblk -f adds the file system type, label and UUID. lsblk -o NAME,SIZE,MODEL,SERIAL shows the disk model and serial number, which helps tell disks apart. -e7 hides loop devices, which snap packages create in large numbers.
3Related tools
blkid prints UUIDs and file system types, df -h shows free space of mounted file systems, and findmnt shows the mount tree.
How to identify a newly added disk
- List devices before connecting the disk:
lsblk -e7 - Connect the disk and run the same command again.
- The new entry without mount points is the new disk; confirm with:
lsblk -o NAME,SIZE,MODEL,SERIAL - Check whether it already has a file system:
lsblk -f
Cautions
- Double-check the device name before running partitioning or formatting tools: a mistake erases the wrong disk.
- Device names can change between boots; use UUIDs in
/etc/fstab.
Related articles
- /etc/fstabWhat each field of /etc/fstab means, why UUIDs are used, and how to test a new entry before rebooting.
- df (disk free)How to read df output, why Use% can reach 100% before Avail is zero for normal users, and how to check inodes with df -i.
- Disk usage with du and ncduHow to find what fills a Linux disk with du and the interactive ncdu, with options that stay on one file system.
Sources
- lsblk(8) manual page man7.org
- blkid(8) manual page man7.org
Last reviewed: