The DF Command

 in
In this series we look at a command. We don't necessarily describe everything it can do but rather some useful capabilities.

The df command is used to show the amount of disk space that is free on file systems. In the examples, df is first called with no arguments. This default action is to display used and free file space in blocks. In this particular case, th block size is 1024 bytes as is indicated in the output.

The first column show the name of the disk partition as it appears in the /dev directory. Subsequent columns show total space, blocks allocated and blocks available. The capacity column indicates the amount used as a percentage of total file system capacity.

The final column show the mount point of the file system. This is the directory where the file system is mounted within the file system tree. Note that the root partition will always show a mount point of /. Other file systems can be mounted in any directory of a previously mounted file system. In the example, there are two other file systems, the first in mounted as /home and the second is mounted as /p4.

In the second example, df is invoked with the -i option. This option instructs df to display information about inodes rather that file blocks. Even though you think of directory entries as pointers to files, they are just a convenience for humans. An inode is what the Linux file system uses to identify each file. When a file system is created (using the mkfs command), the file system is created with a fixed number of inodes. If all these inodes become used, a file system cannot store any more files even though there may be free disk space. The df -i command can be used to check for such a problem.

The df command allows you to select which file systems to display. See the man page for details on this capability.

Figure 1. The DF Command

email: phil@ssc.com

______________________

Phil Hughes

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

about free disk space (linux)

Anonymous's picture

I am trying to find out how much free disk I have. I tried df and it gave me following output. can some explain what it means and how can I infer about the free disk space available to me.

$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 497861 224899 247258 48% /
/dev/sda1 147764 77278 62857 56% /boot
/dev/mapper/rootvg-data
37446324 81844 35462300 1% /data
none 2029744 0 2029744 0% /dev/shm
/dev/mapper/rootvg-home
507748 11902 469632 3% /home
/dev/mapper/rootvg-opt
3031760 1421864 1455888 50% /opt
/dev/mapper/rootvg-tmp
6063688 105684 5649988 2% /tmp
/dev/mapper/rootvg-usr
8579268 4494640 3648816 56% /usr
/dev/mapper/rootvg-cache
4031680 3190276 636604 84% /usr/vice/cache
/dev/mapper/rootvg-var
1515856 237556 1201296 17% /var
AFS 9000000 0 9000000 0% /afs
btvgsa.ibm.com:/gsa/btvgsa-p2
12570759168 11059573696 1511185472 88% /gsa/btvgsa-p2

Hi, I need to retrive

Anonymous's picture

Hi,
I need to retrive the %used from df. can u plz help me in this regard? how to get the field where the fields are not seperated by a common space?

Thanks...

So what does this

Anonymous's picture

So what does this mean?

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda2 23152692 3650356 18326228 17% /usr
/dev/hda6 253775 246507 0 100% /var

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/hda2 2943360 138427 2804933 5% /usr
/dev/hda6 65536 3889 61647 6% /var

Does this mean my /var directory is all used up - yet why does the df -i command say only 6% used?

df command

anonymous's picture

Hmm,
I hope you've found the answer to this already (since February), but yes, your /var partition is nearly full. The 6% number refers to the used inodes, which in turn refers to the maximum number of files you could potentially have, given enough space. In your case, you are limited by the available space, not number of files.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix