[RndTbl] Getting disk sizes of mountpoints
Kevin McGregor
kevin.a.mcgregor at gmail.com
Wed Feb 21 16:35:58 CST 2024
With 'lsblk' I can get something like this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
└─sda1 8:1 0 20G 0 part
├─vg0-root 253:0 0 15G 0 lvm /
└─vg0-var 253:1 0 5G 0 lvm /var
sdb 8:16 0 100G 0 disk
└─sdb1 8:17 0 100G 0 part
└─vg1-data 253:2 0 100G 0 lvm /mnt/data
sr0 11:0 1 1024M 0 rom
What I'm looking for is output like:
/ 15G
/var 5G
/mnt/data 100G
So I just want the size of the block devices which are actually mounted.
I'm wondering what is the most reliable way to produce the second output. I
can just grep for 'lvm', but I can't guarantee the mounts are all LVM type.
I can grep for ' 253:', but is the 253 going to be reliable? What does 253
even mean?
>From https://www.kernel.org/doc/html/latest/admin-guide/devices.html :
240-254 block LOCAL/EXPERIMENTAL USE
Allocated for local/experimental use. For devices not
assigned official numbers, these ranges should be
used in order to avoid conflicting with future assignments.
... which isn't encouraging. Is that list outdated? grep for '/'s?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://muug.ca/pipermail/roundtable/attachments/20240221/a2ab1e0a/attachment.htm>
More information about the Roundtable
mailing list