💾 Command: lsblk (LiSt BLocK devices)
The lsblk command displays information about all available or specified block devices (hard drives, SSDs, USB sticks, and their partitions). Unlike fdisk, it presents the data in a clean, tree-like format that is very easy to read.
1. The "Why"
For an Arch Linux user who manages a dual-boot system and custom partitions, lsblk is your map of the disk:
- Partition Mapping: See exactly how your Arch and Windows partitions are laid out on your SSD.
- Mount Point Verification: Confirm if your EFI partition or your
/homedirectory is mounted correctly. - Identifying New Drives: When you plug in a USB drive to move your files,
lsblktells you if the system sees it assdb,sdc, etc. - Disk Health & Size: Quickly check the total capacity of your drives and how much space is allocated to each partition.
2. Understanding the Output
When you run lsblk, you'll see a table like this:
| Column | Meaning |
|---|---|
| NAME | The device name (e.g., sda for a disk, sda1 for a partition). |
| MAJ:MIN | Major and minor device numbers (used by the kernel). |
| RM | Removable device? (1 = Yes, like a USB; 0 = No, like your SSD). |
| SIZE | The total capacity of the device. |
| RO | Read-Only? (1 = Yes, 0 = No). |
| TYPE | Device type (disk, part for partition, rom for CD-ROM). |
| MOUNTPOINT | Where the partition is attached to your file system (e.g., /, /boot, or /home). |
3. Essential Flags
| Flag | Purpose | Example |
|---|---|---|
-f |
File Systems | Shows the UUID, Label, and File System type (ext4, fat32, ntfs). |
-m |
Permissions | Shows the owner, group, and mode of the device. |
-p |
Full Paths | Prints the full path (e.g., /dev/sda1) instead of just the name. |
-o |
Custom Output | Choose exactly which columns you want to see. |
4. Practical Examples for Your Workflow
A. Finding a Partition's UUID
When editing your /etc/fstab (to make sure your drives mount automatically on boot), you need the UUID. Use:
lsblk -f
This is much safer than using device names like /dev/sda1, which can change if you add more drives.
B. Checking Your Dual-Boot Setup
Since you have a system where Windows and Arch share space, you can identify them by their types:
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
Look for vfat (usually EFI), ntfs (Windows), and ext4 or btrfs (Linux).
C. Identifying a Newly Plugged USB
If you're about to use dd to flash a Linux ISO or move Preader backups:
- Run
lsblk. - Plug in the USB.
- Run
lsblkagain. The new entry is your drive.
5. Pro-Tips
- Arch Linux Context: During your installation or when troubleshooting your rEFInd bootloader,
lsblkhelps you ensure your EFI system partition (ESP) is actually mounted at/bootor/efi. - Tree View: The default tree view is excellent for seeing which partitions belong to which physical disk (e.g.,
nvme0n1p1belongs tonvme0n1). - Scripting: If you're writing a tutorial on system maintenance,
lsblk -Jwill output the data in JSON format, making it easy to parse with other tools.
6. Summary Reference
| Goal | Command |
|---|---|
| View disk tree | lsblk |
| View UUIDs and types | lsblk -f |
| Show full device paths | lsblk -p |
| Custom column view | lsblk -o NAME,SIZE,TYPE |