>

Command/App of the Week: lsblk

Prompt_Bannerlsblk lists information about all or the specified block devices. The lsblk command reads the sysfs filesystem to gather information.

The command prints all block devices (except RAM disks) in a tree-like format by default. Use lsblk --help to get a list of all available columns.

The default output as well as default output from options like –topology and –fs is subject to change, so whenever possible you should avoid using default outputs in your scripts. Always explicitly define expected columns by –output columns in environment where a stable output is required.

Example:

# lsblk
NAME                           MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                              8:0    0  1.4T  0 disk
├─sda1                           8:1    0  500M  0 part /boot
└─sda2                           8:2    0  1.4T  0 part
  ├─vg_netmon01-lv_root (dm-0) 253:0    0   50G  0 lvm  /
  ├─vg_netmon01-lv_swap (dm-1) 253:1    0  3.9G  0 lvm  [SWAP]
  └─vg_netmon01-lv_home (dm-2) 253:2    0  1.3T  0 lvm  /home
sr0                             11:0    1 1024M  0 rom
banner ad

Comments are closed.