--- title: lsblk โ€” inspect block device structure date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: Command that displays disks, partitions, mount points, and sizes in a tree format. tags: program, File and disk management, lsblk --- **๐Ÿ’ฌ "lsblk command"** lsblk shows the disk and partition structure attached to the server in a tree. It is an essential check before adding or mounting disks. While df shows the file system perspective, lsblk shows the **device perspective**. - **Concept**: Displays block devices (disks, partitions, LVM volumes) and mount points in a hierarchy. - **NAME**: Device name. Formats such as `vda`, `vda1`, `nvme0n1p1`. - **SIZE**: Device capacity. - **MOUNTPOINT**: Mounted path. If empty, the device is not mounted. ## Commonly used options | Option | Description | | --- | --- | | -f | Displays file system type, label, and UUID | | -o | Output only the specified columns | | -p | Displays device names with the full path (/dev/...) | | -d | Displays only disks, not partitions | ## Three essential command combinations - `lsblk -f` โ€” Check file system type and mount status - `lsblk -o NAME,SIZE,TYPE,MOUNTPOINT` โ€” View only the columns you need - `lsblk -f /dev/vdb` โ€” Check partitions/filesystems on a specific disk **๐Ÿ’ฌ "Give me an example of isolating a problem server with this command"** This is a step-by-step summary of situations you often encounter on live servers. ### Step 1 ยท Check the overall device structure Check disks, partitions, and mount status. ``` lsblk -f ``` ### Step 2 ยท Choose a new disk Find a device with an empty mount point. ``` lsblk -o NAME,SIZE,TYPE,MOUNTPOINT ``` ### Step 3 ยท Verify after mounting After creating a filesystem and mounting it, check again. ``` lsblk -f /dev/vdb ``` ## In practice, this is how it's used ### 1. Adding a disk **Situation** โ€” You added a volume in the cloud, but it doesn't appear yet. ``` lsblk -o NAME,SIZE,TYPE,MOUNTPOINT ``` **Result** โ€” If a new device (vdb) appears without a MOUNTPOINT, it needs to be mounted. **Point** โ€” Proceed in this order: check device โ†’ create filesystem โ†’ register in /etc/fstab. ### 2. Checking for missing mounts **Situation** โ€” After a reboot, /data appears empty. ``` lsblk -f && grep /data /etc/fstab ``` **Result** โ€” If the device exists but is not mounted, check the fstab configuration or mount failure. **Point** โ€” For partitions not shown by df, first check with lsblk whether the device itself is recognized. ## Things to watch out for - Creating a filesystem on an unmounted device can destroy existing data. Always double-check the device name. - In LVM environments, physical volumes and logical volumes are shown together, which can make the structure complex. Use -o to view only the items you need. - Device names (vda/vdb) can change depending on boot order, so use UUIDs in fstab. ## Actual command output This is the result of checking disks, partitions, and mount points (including vdc, which is not mounted). ![lsblk command output: block device structure](https://games.aidebatehub.com/assets/lsblk-demo.png) Production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/lsblk.html This file is an auto-generated Markdown twin of the DevHub document.