Available disk space on Unix/Linux OS

Solution 1:

On Linux the free space can hide in multitude of places:

  1. Free file system space (the most obvious):

    df -h
    
  2. Unpartitioned space:

    for dev in /dev/sd?; do parted "$dev" print; done
    

    or

    for dev in /dev/sd?; do fdisk -l "$dev"; done
    

    and carefully study how much space is between the partitions, and between partitions and end of the device

  3. Free space in LVM system:

    vgs
    

    or

    pvs
    

    physical volume can use less space than the size of partition, so compare its size to partition size

  4. Space unassigned to partition in MD system:

    for dev in /dev/md*; do mdadm --detail "$dev"; done
    

    You'll need to compare the "Used Dev size" with partition size

  5. File systems can be smaller than the volume they're on (thanks @PaulGear!). You should compare the size of LVM Logical Volume, MD RAID device, partition or some other device the file system resides on with the size of file system (as returned by df).

If you have more than one disk or LVM volume group and relatively new distribution, you may use lsblk to show a tree of block devices together with mountpoints.

NOTE: There's also the difference between marketing GB (which is 10^9B) and OS or engineering GB (which is 2^30B and should be written GiB to differentiate between the two). 40GB is around 37.25GiB. All of the above tools except parted use binary gigabytes as default units. Add unit MiB to parted command, before print to get answers in Mebibytes (also useful for aligning partitions on SSDs and 4KiB sector disks).

Solution 2:

It sounds like perhaps the desire is for a tool such as partitionmanager, or gparted.

http://kde-apps.org/content/show.php?content=89595

http://gparted.sourceforge.net/download.php

cfdisk will also show unallocated space on a disk by disk basis:

cfdisk /dev/sda

Specify the appropriate device - sda, sdb, sdc etc.

Solution 3:

Try:

df -h 

or

fdisk -l *

http://www.unix.com/red-hat/178290-get-unallocated-disk-space.html

Above link have some more description on what you are after

http://www.computerhope.com/unix/udf.htm Hope this helps

Solution 4:

You can see the partitions with "df -h". For the rest you can use "parted discname" and then "print".