Skip to content


List disks or other block devices on a Centos/RedHat box

Really, LINUX (RedHat/Centos) does not have lsdev -Cc disk but it has the lsblk command which may deliver the info you need. Tonight, I was looking for a way to identify disks during a KickStart so the boot logical volume is placed on a dedicated disk of a very specific size (500MB) and other disks depending on their size are used to create either the “rootvg” or an “application_vg” …… .
Now, a few examples of this command in action.

A “physical” machine:

#  lsblk -ido KNAME,TYPE,SIZE,MODEL
KNAME TYPE   SIZE MODEL
sda   disk 232.9G WDC WD2500AAKX-0
sr0   rom   1024M DVD-RW DH16ACSH

A “VMWare guest with a few disks attached:

# lsblk -ido KNAME,TYPE,SIZE,MODEL
KNAME TYPE  SIZE MODEL
sda   disk    1G Virtual disk
sdb   disk   70G Virtual disk
sdc   disk    5G Virtual disk
sdd   disk    5G Virtual disk
sde   disk    5G Virtual disk
sdf   disk    5G NAS Platform
sr0   rom  1024M VMware SATA CD00 
# lsblk -P
NAME="sda" MAJ:MIN="8:0" RM="0" SIZE="232.9G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="sda1" MAJ:MIN="8:1" RM="0" SIZE="512M" RO="0" TYPE="part" MOUNTPOINT="/boot"
NAME="sda2" MAJ:MIN="8:2" RM="0" SIZE="228.5G" RO="0" TYPE="part" MOUNTPOINT=""
NAME="rootvg-vol01" MAJ:MIN="253:0" RM="0" SIZE="1G" RO="0" TYPE="lvm" MOUNTPOINT="/"
NAME="rootvg-vol05" MAJ:MIN="253:1" RM="0" SIZE="4G" RO="0" TYPE="lvm" MOUNTPOINT="/usr"
NAME="rootvg-vol06" MAJ:MIN="253:2" RM="0" SIZE="4G" RO="0" TYPE="lvm" MOUNTPOINT="/opt"
NAME="rootvg-vol05a" MAJ:MIN="253:3" RM="0" SIZE="1G" RO="0" TYPE="lvm" MOUNTPOINT="/usr/local"
NAME="rootvg-vol04a" MAJ:MIN="253:4" RM="0" SIZE="4G" RO="0" TYPE="lvm" MOUNTPOINT="/var/log/audit"
NAME="rootvg-vol04" MAJ:MIN="253:5" RM="0" SIZE="4G" RO="0" TYPE="lvm" MOUNTPOINT="/var/log"
NAME="rootvg-vol03" MAJ:MIN="253:6" RM="0" SIZE="2G" RO="0" TYPE="lvm" MOUNTPOINT="/var"
NAME="rootvg-vol02" MAJ:MIN="253:7" RM="0" SIZE="2G" RO="0" TYPE="lvm" MOUNTPOINT="/tmp"
NAME="rootvg-vol08" MAJ:MIN="253:8" RM="0" SIZE="1G" RO="0" TYPE="lvm" MOUNTPOINT="/root"
NAME="sr0" MAJ:MIN="11:0" RM="1" SIZE="1024M" RO="0" TYPE="rom" MOUNTPOINT=""
# lsblk -a
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0    1G  0 disk
  sda1            8:1    0  360M  0 part /boot
sdb               8:16   0   70G  0 disk
  rootvg-swap   253:0    0    4G  0 lvm  [SWAP]
  rootvg-vol01  253:1    0    1G  0 lvm  /
  rootvg-vol05  253:2    0    4G  0 lvm  /usr
  rootvg-vol07  253:3    0    2G  0 lvm  /home
  rootvg-vol06  253:4    0    4G  0 lvm  /opt
  rootvg-vol05a 253:5    0    2G  0 lvm  /usr/local
  rootvg-vol04a 253:6    0    4G  0 lvm  /var/log/audit
  rootvg-vol04  253:7    0    4G  0 lvm  /var/log
  rootvg-vol03  253:8    0    2G  0 lvm  /var
  rootvg-vol02  253:9    0    4G  0 lvm  /tmp
  rootvg-vol08  253:10   0    1G  0 lvm  /root
sdc               8:32   0    5G  0 disk
sdd               8:48   0    5G  0 disk
sde               8:64   0    5G  0 disk
sdf               8:80   0    5G  0 disk
  sdf1            8:81   0    5G  0 part
sr0              11:0    1 1024M  0 rom

Posted in LINUX, Real life AIX.

Tagged with , , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

WordPress Anti Spam by WP-SpamShield



Copyright © 2016 - 2018 Waldemar Mark Duszyk. All Rights Reserved. Created by Blog Copyright.