df command in Linux to check Disk Space

df command in Linux :

In this article we’ll discuss how to check Disk space information in Linux. Using df command in Linux you can check how much space available or used on my hard drive.

When you use df command without any argument, the df command will display information about all mounted file systems.
[oracle@node-1 ~]$ df
Filesystem     1K-blocks     Used Available Use% Mounted on
devtmpfs         1513056        0   1513056   0% /dev
tmpfs            1531160        0   1531160   0% /dev/shm
tmpfs            1531160     9448   1521712   1% /run
tmpfs            1531160        0   1531160   0% /sys/fs/cgroup
/dev/sda3       20961280 11000956   9960324  53% /
/dev/sda8       31436804    33008  31403796   1% /u02
/dev/sda5        5232640   118896   5113744   3% /home
/dev/sda2       36682240 10046640  26635600  28% /u01
/dev/sda1        1038336   214164    824172  21% /boot
/dev/sda6        5232640    33096   5199544   1% /tmp
network_drive  209713148 50298324 159414824  24% /media/sf_network_drive
tmpfs             306232       12    306220   1% /run/user/42
tmpfs             306232        0    306232   0% /run/user/0
[oracle@node-1 ~]$

To display information only for a specific file system, pass its name or the mount point to the df command.

[oracle@node-1 ~]$ df /
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda3       20961280 11001240   9960040  53% /
[oracle@node-1 ~]$

Each line includes the following columns :

Filesystem” – The name of the filesystem.
1K-blocks” – The size of the filesystem in 1K blocks.
Used” – The used space in 1K blocks.
Available” – The available space in 1K blocks.
Use%” – The percentage of used space.
Mounted on” the directory on which the filesystem is mounted.

Show Disk Space Usage in Human Readable Format :

By default, the df command display the disk space information in 1-kilobyte blocks and the size of used and available disk space in kilobytes.

To display information about disk drives in human-readable format (kilobytes, megabytes, gigabytes and so on), invoke the df command with the -h option:

[oracle@node-1 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.5G     0  1.5G   0% /dev
tmpfs           1.5G     0  1.5G   0% /dev/shm
tmpfs           1.5G  9.3M  1.5G   1% /run
tmpfs           1.5G     0  1.5G   0% /sys/fs/cgroup
/dev/sda3        20G   11G  9.5G  53% /
/dev/sda8        30G   33M   30G   1% /u02
/dev/sda5       5.0G  117M  4.9G   3% /home
/dev/sda2        35G  9.6G   26G  28% /u01
/dev/sda1      1014M  210M  805M  21% /boot
/dev/sda6       5.0G   33M  5.0G   1% /tmp
network_drive   200G   48G  153G  24% /media/sf_network_drive
tmpfs           300M   12K  300M   1% /run/user/42
tmpfs           300M     0  300M   0% /run/user/0
[oracle@node-1 ~]$

To display information only for a specific file system in Human-readable format, pass its name or the mount point to the df command.

[oracle@node-1 ~]$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        20G   11G  9.5G  53% /
[oracle@node-1 ~]$

File System Types :

The ” -T ” option is used to display file system types information. The output includes an additional column named ” Type ” showing the type of the filesystem :

[oracle@node-1 ~]$ df -T
Filesystem     Type     1K-blocks     Used Available Use% Mounted on
devtmpfs       devtmpfs   1513056        0   1513056   0% /dev
tmpfs          tmpfs      1531160        0   1531160   0% /dev/shm
tmpfs          tmpfs      1531160     9448   1521712   1% /run
tmpfs          tmpfs      1531160        0   1531160   0% /sys/fs/cgroup
/dev/sda3      xfs       20961280 11000992   9960288  53% /
/dev/sda8      xfs       31436804    33008  31403796   1% /u02
/dev/sda5      xfs        5232640   118896   5113744   3% /home
/dev/sda2      xfs       36682240 10046672  26635568  28% /u01
/dev/sda1      xfs        1038336   214164    824172  21% /boot
/dev/sda6      xfs        5232640    33096   5199544   1% /tmp
network_drive  vboxsf   209713148 50298324 159414824  24% /media/sf_network_drive
tmpfs          tmpfs       306232       12    306220   1% /run/user/42
tmpfs          tmpfs       306232        0    306232   0% /run/user/0
[oracle@node-1 ~]$

Display Inode Usage :

An inode is a data structure in Unix and Linux file systems, which contains information about a file or directory such as its size, owner, device node, socket, pipe, etc., except da.

When invoked with the -i option, the df command prints information about the filesystem inodes usage.

The command below will show information about the inodes on the file system mounted to system root directory / in human-readable format:

[oracle@node-1 ~]$ df -i /
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/sda3      20971520 218387 20753133    2% /
[oracle@node-1 ~]$
[oracle@node-1 ~]$ df -ih /
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/sda3         20M  214K   20M    2% /
[oracle@node-1 ~]$

When -i option is used, each line of the output includes the following columns:

Filesystem ” – The name of the filesystem.
Inodes ” – The total number of inodes on the file system.
IUsed ” – The number of used inodes.
IFree ” – The number of free (unused) inodes.
IUse% ” – The percentage of used inodes.
Mounted on ” – the directory on which the filesystem is mounted.

I hope my written content will helped you. Your suggestions/feedback are most welcome from orakldba.com.
Keep learning… Have a great day!!!
Please comment here for your any query related to above content. You can write to mail me through : orakldba@gmail.com.

Leave a Comment