[RndTbl] Getting disk sizes of mountpoints

Vijay Sankar vsankar at foretell.ca
Wed Feb 21 16:43:56 CST 2024


Doesn’t df -h give that info? Sorry if I misunderstood your question. 

Sent from my iPhone

> On Feb 21, 2024, at 16:36, Kevin McGregor <kevin.a.mcgregor at gmail.com> wrote:
> 
> 
> 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?
> 
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.ca
> https://muug.ca/mailman/listinfo/roundtable
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://muug.ca/pipermail/roundtable/attachments/20240221/cd0ef86e/attachment.htm>


More information about the Roundtable mailing list