Score:0

mapping lshw output to lsblk to get disk storage

id flag

I am trying to get all the hardware devices in one pass and later get more details on each one of them. So, I start with lshw and use lshw -short -c storage to get storage devices, shows something like this

[root@sys7-vm23: admin]# lshw -short -c storage 
H/W path      Device      Class          Description
====================================================
/0/100/1.1                storage        82371SB PIIX3 IDE [Natoma/Triton II]
/0/100/a                  storage        Virtio block device
/0/1          scsi0       storage        
/0/2          scsi2       storage        

Now, I want to get the capacity of the disk but I am not sure how to map this info to lsblk or fdisk !

[root@sys7-vm23: admin]# lsblk 
NAME                     MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                        8:0    0    10G  0 disk 
└─sda1                     8:1    0    10G  0 part 
sr0                       11:0    1  1024M  0 rom  
vda                      253:0    0    80G  0 disk 
├─vda1                   253:1    0   243M  0 part /boot
├─vda2                   253:2    0     1K  0 part 
└─vda5                   253:5    0  79.8G  0 part 
  ├─system-root (dm-0)   252:0    0  71.7G  0 lvm  /
  └─system-swap_1 (dm-1) 252:1    0     8G  0 lvm  [SWAP]

Can I directly use the H/W Path information to get the disk capacity ?

This is a VM, with LVM configured, but I want a generic way (with or without LVM)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.