How to List Block Device Information - lsblk Command

To List Block Device Information &ndash lsblk Command

In this manual we will learn how to use lsblk command. It lists the information about the specified block devices. It prints all the details of the system in tree format except the RAM details.

To display block information

Run lsblk command to display all device information in tree format.

root@user1-linuhelp:/home/user1# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0      2:0    1    4K  0 disk 
sda      8:0    0   20G  0 disk 
??sda1   8:1    0   14G  0 part /
??sda2   8:2    0    1K  0 part 
??sda5   8:5    0  2.8G  0 part [SWAP]
??sda6   8:6    0  3.2G  0 part 
sr0     11:0    1 1024M  0 rom

To display block information along with the empty node

Run lsblk command with &ndash a option to display all device block information including empty node.

root@user1-linuhelp:/home/user1# lsblk &ndash a
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0      2:0    1    4K  0 disk 
sda      8:0    0   20G  0 disk 
??sda1   8:1    0   14G  0 part /
.
.
.
loop4    7:4    0        0 loop 
loop5    7:5    0        0 loop 
loop6    7:6    0        0 loop 
loop7    7:7    0        0 loop

To display group information and ownership

Run lsblk command along with &ndash m option to display the ownership and group information details about device.

root@user1-linuhelp:/home/user1# lsblk &ndash m
NAME    SIZE OWNER GROUP MODE
fd0       4K root  disk  brw-rw----
sda      20G root  disk  brw-rw----
??sda1   14G root  disk  brw-rw----
??sda2    1K root  disk  brw-rw----
??sda5  2.8G root  disk  brw-rw----
??sda6  3.2G root  disk  brw-rw----
sr0    1024M root  cdrom brw-rw----

To display a specific block information

Run lsblk command with &ndash p option to display the details about a specific device block.

root@user1-linuhelp:/home/user1# lsblk -b /dev/sda2
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda2   8:2    0  1024  0 part

To display devices without header

Run lsblk command along with &ndash l option to List devices Without Header.

root@user1-linuhelp:/home/user1# lsblk &ndash l
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0    2:0    1    4K  0 disk 
sda    8:0    0   20G  0 disk 
sda1   8:1    0   14G  0 part /
sda2   8:2    0    1K  0 part 
sda5   8:5    0  2.8G  0 part [SWAP]
sda6   8:6    0  3.2G  0 part 
sr0   11:0    1 1024M  0 rom

To display the scsi device information

Run lsblk command along with &ndash S option to display the scsi device information.

root@user1-linuhelp:/home/user1# lsblk &ndash S
NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
sda  32:0:0:0   disk VMware,  VMware Virtual S 1.0  spi
sr0  3:0:0:0    rom  NECVMWar VMware SATA CD01 1.00 sata

To print the result in inverse mode

Run lsblk command with &ndash s option to print the result in inverse mode.

root@user1-linuhelp:/home/user1# lsblk &ndash s
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0     2:0    1    4K  0 disk 
sda1    8:1    0   14G  0 part /
??sda   8:0    0   20G  0 disk 
sda2    8:2    0    1K  0 part 
??sda   8:0    0   20G  0 disk 
sda5    8:5    0  2.8G  0 part [SWAP]
??sda   8:0    0   20G  0 disk 
sda6    8:6    0  3.2G  0 part 
??sda   8:0    0   20G  0 disk 
sr0    11:0    1 1024M  0 rom  

To print full device information

Run lsblk command with &ndash f option it will print the full device information.

root@user1-linuhelp:/home/user1# lsblk &ndash f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
fd0                                                      
sda                                                      
??sda1 ext4         24239319-e01a-419f-ab4a-f6852cd205ee /
??sda2                                                   
??sda5 swap         4252cd14-93ea-4a58-9888-7c2c0fa4fa5e [SWAP]
??sda6 ext4         26f64b2d-92e8-411c-95b3-8dd08c0ffa9a

To print the result in ASCII character

Run lsblk command with &ndash i option print the output in ASCII character with tree formatting.

root@user1-linuhelp:/home/user1# lsblk &ndash i
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0      2:0    1    4K  0 disk 
sda      8:0    0   20G  0 disk 
|-sda1   8:1    0   14G  0 part /
|-sda2   8:2    0    1K  0 part 
|-sda5   8:5    0  2.8G  0 part [SWAP]
`-sda6   8:6    0  3.2G  0 part 
sr0     11:0    1 1024M  0 rom

To hide the header lines

Run lsblk command with &ndash n option to hide the header lines.

root@user1-linuhelp:/home/user1# lsblk &ndash n
fd0      2:0    1    4K  0 disk 
sda      8:0    0   20G  0 disk 
??sda1   8:1    0   14G  0 part /
??sda2   8:2    0    1K  0 part 
??sda5   8:5    0  2.8G  0 part [SWAP]
??sda6   8:6    0  3.2G  0 part 
sr0     11:0    1 1024M  0 rom  

Run lsblk command with &ndash P option it will produce the output in key format.

root@user1-linuhelp:/home/user1# lsblk &ndash P
NAME=" fd0"  MAJ:MIN=" 2:0"  RM=" 1"  SIZE=" 4K"  RO=" 0"  TYPE=" disk"  MOUNTPOINT=" " 
NAME=" sda"  MAJ:MIN=" 8:0"  RM=" 0"  SIZE=" 20G"  RO=" 0"  TYPE=" disk"  MOUNTPOINT=" " 
NAME=" sda1"  MAJ:MIN=" 8:1"  RM=" 0"  SIZE=" 14G"  RO=" 0"  TYPE=" part"  MOUNTPOINT=" /" 
NAME=" sda2"  MAJ:MIN=" 8:2"  RM=" 0"  SIZE=" 1K"  RO=" 0"  TYPE=" part"  MOUNTPOINT=" " 
NAME=" sda5"  MAJ:MIN=" 8:5"  RM=" 0"  SIZE=" 2.8G"  RO=" 0"  TYPE=" part"  MOUNTPOINT=" [SWAP]" 
NAME=" sda6"  MAJ:MIN=" 8:6"  RM=" 0"  SIZE=" 3.2G"  RO=" 0"  TYPE=" part"  MOUNTPOINT=" " 
NAME=" sr0"  MAJ:MIN=" 11:0"  RM=" 1"  SIZE=" 1024M"  RO=" 0"  TYPE=" rom"  MOUNTPOINT=" " 

To display the outout in raw format

Run lsblk command with &ndash r option to display the output in raw format.

root@user1-linuhelp:/home/user1# lsblk &ndash r
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk 
sda 8:0 0 20G 0 disk 
sda1 8:1 0 14G 0 part /
sda2 8:2 0 1K 0 part 
sda5 8:5 0 2.8G 0 part [SWAP]
sda6 8:6 0 3.2G 0 part 
sr0 11:0 1 1024M 0 rom

To display full device path

Run lsblk command with &ndash p option to display the full device path information.

root@user1-linuhelp:/home/user1# lsblk &ndash p
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
/dev/fd0      2:0    1    4K  0 disk 
/dev/sda      8:0    0   20G  0 disk 
??/dev/sda1   8:1    0   14G  0 part /
??/dev/sda2   8:2    0    1K  0 part 
??/dev/sda5   8:5    0  2.8G  0 part [SWAP]
??/dev/sda6   8:6    0  3.2G  0 part 
/dev/sr0     11:0    1 1024M  0 rom

To display the available column

Run lsblk command with &ndash O option to display all available column .

root@user1-linuhelp:/home/user1# lsblk &ndash O
NAME   KNAME MAJ:MIN FSTYPE MOUNTPOINT LABEL UUID                                 PARTTYPE PARTLABEL PARTUUID                             PARTFLAGS  RA RO RM HOTPLUG MODEL       SERIAL       SIZE STATE OWNER GROUP MODE       ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED    RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO WSAME WWN RAND PKNAME HCTL       TRAN   SUBSYSTEMS   REV VENDOR
fd0    fd0     2:0                                                                                                                                  128  0  1       1                            4K       root  disk  brw-rw----         0    512      0     512     512    1 deadline     128 disk        0        0B       0B         0    0B        1                          block:platform
.
.
.
sr0    sr0    11:0                                                                                                                                  128  0  1       1 VMware SATA 01000000000 1024M runni root  cdrom brw-rw----         0    512      0     512     512    1 deadline     128 rom         0        0B       0B         0    0B        1        3:0:0:0    sata   block:scsi:pci

To display the device block topology

Run lsblk command with &ndash t option to display the device block topology

root@user1-linuhelp:/home/user1# lsblk -t 
NAME   ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED    RQ-SIZE  RA WSAME
fd0            0    512      0     512     512    1 deadline     128 128    0B
sda            0    512      0     512     512    1 deadline     128 128    0B
??sda1         0    512      0     512     512    1 deadline     128 128    0B
??sda2         0    512      0     512     512    1 deadline     128 128    0B
??sda5         0    512      0     512     512    1 deadline     128 128    0B
??sda6         0    512      0     512     512    1 deadline     128 128    0B
sr0            0    512      0     512     512    1 deadline     128 128    0B

To check the version

Run the lsblk command along with -V to display the version of lsblk.

root@user1-linuhelp:/home/user1# lsblk &ndash V
lsblk from util-linux 2.26.2
Tag : lsblk
FAQ
Q
which command used To display a specific block information?
A
display a specific block information vy following command
# lsblk -b /dev/sda2
Q
how To display full device path information of lsblk
A
display full device path information of lsblk by following command
# lsblk &ndash p
Q
which command to check the version of lsblk?
A
use the below commadn to check the version on lsblk
# lsblk &ndash V
Q
How to verify the lsblk command in CentOS/Redhat?
A
You can verify the lsblk by following command

# which lsblk

output
/usr/bin/lsblk
Q
What is Purpose of uisng the List block device information?
A
It lists the information about the specified block devices. It prints all the details of the system in tree format except the RAM details.