Friday, September 18, 2009

Disk space usage using df command.

To get a listing of free space on all mounted filesystems execute df command with no arguments.

# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 33423168 16560892 15137044 53% /
/dev/sda1 101086 14952 80915 16% /boot
tmpfs 257560 0 257560 0% /dev/shm


Use the df command with -h option to displays the space in human-readable units , the example below show the freespace available in Mb unit:

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 32G 16G 15G 53% /
/dev/sda1 99M 15M 80M 16% /boot
tmpfs 252M 0 252M 0% /dev/shm


Note: The Use% column shows what percentage of the filesystem that currently in use.

To show space on the filesystems those directories are mounted on:

# df /boot
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 101086 14952 80915 16% /boot


The df command can be use to get information on inode usage on all mounted filesystem.  To show the inode information execute df command with the ( -i  ) option:

df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/VolGroup00-LogVol00 8633856 313455 8320401 4% /
/dev/sda1 26104 37 26067 1% /boot
tmpfs 64390 1 64389 1% /dev/shm


The following are some of the flags and arguments that can be used for the df command:
-a, --all include filesystems having 0 blocks
-B, --block-size=SIZE use SIZE-byte blocks
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si likewise, but use powers of 1000 not 1024
-i, --inodes list inode information instead of block usage
-k like --block-size=1K
-l, --local limit listing to local filesystems
--no-sync do not invoke sync before getting usage info (default)
-P, --portability use the POSIX output format
--sync invoke sync before getting usage info
-t, --type=TYPE limit listing to filesystems of type TYPE
-T, --print-type print filesystem type
-x, --exclude-type=TYPE limit listing to filesystems not of type TYPE
-v (ignored)
--help display this help and exit
--version output version information and exit

NAME:
df - report filesystem disk space usage
Usage: df [OPTION]... [FILE]...

for more information on df command:
# info df
# man df
# df --help

No comments:

Post a Comment