Lesson: Other Unix Stuff

Disc Quota

You will probably be battling a limitation on disk space throughout this course, so you need to know how to determine your available space.

Many system administrators set disk quotas that define the maximum amount of hard disk space allowed for user files. This tutorial covers how to determine your quota limits and how to keep from going over quota.

What is Disk Quota?

Disk quota defines the maximum amount of hard disk space allowed for a user's files. There are two quota limits: the hard limit and the soft limit. The hard limit defines the absolute maximum. When the hard limit is reached, the system will not allow a user any more space. This effectively stops you from using your Unix account to create new files, edit old files, compiling programs, etc. The soft limit is the desired maximum. After exceeding the soft limit, the system warns the user and starts a grace period. Typically grace period times are between 5 and 9 days. When the grace period ends, the system will not allow the user any more space.

The quota command displays a user's quotas. On most Unix systems type




  > quota



to see your quotas. Solaris users must use the -v option.



  > quota -v



Output will appear similar to the following.



Disk quotas for lizr (uid 1152):



Filesystem     usage  quota limit timeleft files quota limit timeleft



/var/spool/mail    0   3072  5144              1     0     0            



/home           1377   3072  5144            146     0     0            



/tmp               0   1024  1024              0     0     0            



The first column specifies the filesystem on which a quota is set. A filesystem is an area of hard disk space set aside for a particular purpose. Each filesystem is associated with a directory. For example, the /home filesystem, shown above, stores user's home directories. The filesystem includes the entire /home directory tree including all its files and subdirectories.

The above example is typical of many Unix systems. The user lizr has quota limits set on three filesystems:

/var/spool/mail
This is the filesystem that contains incoming mail.
/home
This is the filesystem that contains lizr's home directory. All her personal files and subdirectories are stored on this filesystem.
/tmp
This filesystem contains temporary files. Many programs such as vi create temporary files and store them in the /tmp directory.

You may have quota limits set on different filesystems than those shown above or on filesystems with different names. For example,




Disk quotas for bobz (uid 1789):



Filesystem     usage  quota limit timeleft files quota limit timeleft



/usr/home       1377   3072  5144            146     0     0            



This user only has quota limits set on one filesystem: /usr/home. The filesystem containing user's home directories is often associated with the directory /usr/home rather than /home.

The next three columns of output from the quota command tell you how much hard drive space you are using on each filesystem, the soft limit and the hard limit respectively. On most Unix systems these will be listed in Kilobytes. The fourth column lists the number of days left in the grace period if the user is over the soft limit. In the above example, the user bobz is using a little less than 1.5 Megabytes of disk space, his soft limit is 3 Megabytes and his hard limit is 5 Megabytes. The timeleft column is blank because bobz has not exceeded the soft limit (usage < soft limit).

You should never exceed the hard limit or the soft limit for more than the grace period. It will cause serious difficulty using your Unix account and can lead to loss of data while trying to edit files or read email.

Use the quota -v to find out what your disk and number of files quota is for your nsm home directory, and for your class directory.

Using Aliases

If you use a certain command very often, it is often worth setting an alias. In your home directory there is a .aliases file that is activated when you start a new shell.

Go to your home directory by typing cd with nothing after it. Open the file .aliases in pico. If you do not have an .aliases file, this should create a new one. Add the following line to the file:

alias gohome cd /nsm/home/username

where username is your username.

Save the file. Now open a new unix shell and type gogis. You should be taken directly to your home directory.

This command will work regardless of what directory you are working in.

 

 

< Directories and Files | Introduction >