Disk Usage

Monitoring and controlling UNIX disk space use

Reviewed by John Sopko 11/13/2019

Your home directory is the directory you find yourself in when you log in on virtually any Linux machine in the department. All users’ home directories can be accessed by the path /home/login the actual directory will be in a partition (a part of a disk) of some AFS file server. Note that /home/login is a symbolic link to your AFS space in our cell /afs/cs.unc.edu/home/login.

1. To find out how much AFS space you are using execute the commands:

cd (this takes you to your home directory)
fs exam .

File . (536884167.1.1) contained in volume 536884167
Volume status for vid = 536884167 named D3.home.frog
Current disk quota is 4000000
Current blocks used are 2051002
The partition has 71458102 blocks available out of 129319696


The “Current disk quota” and “Current blocks used” are given in 1k blocks, so, for example, “Current blocks used are 2051002” indicates you are using 2051 MegaBytes or 2.051GigaBytes of space and the quote is 4GB. The partition space is the amount of space on the physical disk partition also in 1k blocks.

2. The disk space of any file or directory can be determined using the Linux “du”, (disk usage), command. You can use this at the top level of your home directory to learn how much space that directory takes. The numbers provided are in kilobytes; see “man du” for details. For example, the following du command gives a summary of the size of all directories in your home directory:

du -s .??* *

The results are given in kilobytes. You can use the “-h” (human readable) option to have larger files and directories listed in megabytes or gigabytes. From the output of the du command you can see which directories are taking the most room and cd to those directories and repeat the command to isolate where all your space is being used.

NOTE: If you have any volumes mounted under your home directory or sub-directories the du command will include those in your total. Use the “fs ls *” comand in a directory to see if any volumes mounted in a directory. Most users do not mount volumes in there home directory and this is not an issue.

3. For information on the total space available on the partition where your home directory currently resides, execute the following afs command:

fs df


If you have a Computer Science google account you can move files into your google drive space. Currently there is no space limit in your departments google drive.

To reduce your disk space use, you can either remove, truncate, or compress some files. Here are some specific methods:

  1. Simply remove files you are sure you don’t need any more.
  2. Copy files you will not need for a good while to DVD. You can buy them at the Student Stores.
  3. An option for files-I’m-going-to-need-soon-but-not-today is to “tar” and “compress” them. Example: You have a “working copy” of a directory called “bigdir”:


% cd bigdir
 % make clean (.o files don't compress well)
 cd ..
 % tar cf bigdir.tar bigdir
 % gzip -v bigdir.tar (creates bigdir.tar.gz)
 % rm -rf bigdir


Compression is usually 50-60% for text files but can be as high as 90%.




% cd to-where-you-want-the-software
% tar zxf bigdir.tar.gz