List information about block devices using lsblk

lsblk let’s you view information about block devices on a GNU/Linux system.

The output is tree-like and very elegant, with information that would generally require running 3-4 commands. It combines data from mount, df , dmsetup, lvm and raid commands.

lsblk get it’s data from the /sys filesystem.

Here is lsblk output on my system :

$ lsblk
NAME                       MAJ:MIN RM   SIZE RO MOUNTPOINT
sda                          8:0    0 298.1G  0
├─sda1                       8:1    0   500M  0 /boot
└─sda2                       8:2    0 297.6G  0
  ├─vg_rags-lv_swap (dm-0) 253:0    0   5.8G  0 [SWAP]
  ├─vg_rags-lv_root (dm-1) 253:1    0    50G  0 /
  └─vg_rags-lv_home (dm-2) 253:2    0 241.8G  0
    └─home (dm-3)          253:3    0 241.8G  0 /home
sr0                         11:0    1  1024M  0

lsblk is part of the util-liunx package :

$ rpm -qf `which lsblk`
util-linux-2.19.1-1.4.fc15.x86_64

Running fdisk -l gives similar data. But, fdisk requires root privileges, and It does not understand dm or lvm partitions.

Advertisements

3 thoughts on “List information about block devices using lsblk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s