-1

I want to check used space for each and every partition in Linux. I am using this command to get size of each partition but not able to get used space or free space.

$ cat /proc/partitions
major minor   #blocks  name

   8      0   16777216  sda
   8      1     512000 sda1
   8      2   16264192 sda2
 253      0   14585856 dm-0     
 253      1    1675264 dm-1

I am able to get used space using df command, but it shows filesystems and it's not able to get used space for all the partitions like /dev/sda2.

$ df -Tl
Filesystem           Type  1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
                     ext4   14225776 3791704   9704780  29% /
tmpfs                tmpfs    961596      72    961524   1% /dev/shm
/dev/sda1            ext4     487652   40187    421865   9% /boot

I want to calculate disk utilization. Is there any way to get used space and total space for each and every partition?

1 Answers1

1

Since df -Tl shows a volumegroup it means you are using LVM on top of normal partitioning. This means that for the operating system the partition is always fully utilized and will show no free space. With df you can see the free space in the logical volume root. If you want to see more info from lvm you can run for example pvdisplay to see how the physical volumes are configured, and then lvdisplay to see how the logical volumes are configured.

Elias
  • 681