Use lsblk Command for Storage Analysis
As I’m working through my very first ebook under the Unix Tutorial brand, I’m learning lots of very interesting things about managing software RAID devices.
Part of effective RAID management is knowing where you stand. I’ve shown you how to use /proc/mdstat already, but today’s command is a higher level one (works with all storage devices, not just RAID).
I use lsblk to report sizes of all the storage devices in my Linux system along with mount points (if known) and RAID membership info.
For each RAID device, you’ll see the following:
- type of RAID array – raid0, raid5, etc
- RAID array that any device is a member of
Check this out:
root@ubuntu18:~# lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT NAME SIZE FSTYPE TYPE MOUNTPOINT loop0 86.6M squashfs loop /snap/core/4486 loop1 86.9M squashfs loop /snap/core/4917 sda 10G disk ├─sda1 1M part └─sda2 10G ext4 part / sdb 1G linux_raid_member disk └─md0 2G ext4 raid0 /raid0 sdc 1G linux_raid_member disk └─md0 2G ext4 raid0 /raid0 sdd 1G linux_raid_member disk └─md1 1023M ext4 raid1 sde 1G linux_raid_member disk └─md1 1023M ext4 raid1 sdf 1G linux_raid_member disk └─md2 2G ext4 raid5 sdg 1G linux_raid_member disk └─md2 2G ext4 raid5 sdh 1G linux_raid_member disk └─md2 2G ext4 raid5 sdi 1G disk sdj 1G disk sr0 1024M rom
In this output you can see that sdb and sdc are members of RAID0 array md0. sdd and sde are forming RAID1 called md1. Finally, sdf/sdg/sdh are members of RAID5 array.