Managing Disk Space on the Lab Suns

Finding Current Disk Usage with df

You can find all the mounted file systems space usage by typing:

df -k

An excerpt from the output of df -k looks something like this:

Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0 1984230 1791665 133039 94% /
/dev/dsk/c0t0d0s3 6484885 1607988 4812049 26% /space
piemonte.eecs.uic.edu:/usr/local 2597102 1482135 1063025 59% /usrlocal
piemonte.eecs.uic.edu:/backup/monviso 15441539 10071320 5215804 66% /backup

The headings are:

Filesystem
The actual location of this file system. A notation like /dev/dsk/c0t0d0s3 means it is on local disk number 0, partition number 3. A notation like piemonte.eecs.uic.edu:/usr/local means it is on piemonte, at the designated path, and we have mounted it remotely via nfs.
kbytes
The size of the file system in k-bytes
used
what you think
avail
kbytes - used
capacity
used ÷ kbytes, percentage that is in use. This can exceed 100%, because unix filesystems sometimes have a little extra capacity above the official limit
Mounted on
The mount point on the local filesystem

The above example shows that 5.2 GB are available on the /backup filesystem. Usually 2-3 GB is needed for a backup file.

Notice that for nfs-mounted files, the local filesystem path (e.g. /usrlocal or /backup ) does not have to match the filesystem path on the file's home computer.

Why You Almost Always Use df -k Instead of plain df

Checking the space occupied by directories

Sometimes, you will need to check the space occupied by all the subdirectories of a certain directory (for example, because you want to know the directory that is occupying most space. You can use the command du in a form like:

du -kd

this will list the space occupied by all directories and their subdirectory from the current position. For more info see the man pages.

More to come

This page is not finished, but finding the disk usage is the first skill needed.

Home

Last Revised: 24 May 2003
Riccardo Serafin