Solaris Disk Quota Implementation & Management Thu, 04/05/2007 - 16:52 — birijan

A disk quota is a limit set by a system administrator that restricts certain aspects of file system usage on modern operating systems. There are two basic types of disk quotas. The first, known as a block quota(usage quota) that limits the amount of disk space that can be used and the second, known as a node quota(file quota) that limits the number of files and directories that can be created.

In addition, administrators usually define a warning level, or soft quota, at which users are informed they are nearing their limit, that is less than the effective limit, or hard quota. There may also be a small grace interval, which allows users to temporarily violate their quotas by certain amounts if necessary.

Soft Limits functions as stage-1 or warning stage. If user exceeds soft limit, timer is invoked (default 7-days). For example if user soft limit is 100MB and if user exceeds beyond timer, soft limit becomes hard limit and Hard Limits functions as a storage ceiling and CANNOT be exceeded. If user meets hard limit, system will not allocate additional storage.

While allocating quota system there are two different 2 objects being monitored: 1. BLOCKS (based on how many blocks) 2. INODES (base on how may inodes)

Quota Commands:

edquota - facilitates the creation of quotas for users quotacheck - checks for consistency in usage and quota policy quotaon - enables quotas on file system repquota - displays quota information

Steps to enable quota support

modify /etc/vfstab

Edit "Mount Options" column and replace '-' with 'rq'.

#device mount #to mount options

device to fsck

mount point

FS type

fsck pass

mount at boot

/dev/dsk/c0d0s7 to /dev/dsk/c0d0s7 rq

/dev/rdsk/c0d0s7

/export/home

ufs

2

yes

/dev/rdsk/c0d0s7

/export/home

ufs

2

yes

create empty 'quotas' file in root of desired file system

bash-3.00$ touch /export/home/quotas bash-3.00$ chmod 600 /export/home/quotas

Edit user quotas for ufs file system (here user is john)

bash-3.00$ edquota john

# Edit soft limit and hard limit fs /export/home blocks (soft = 5000, hard = 10000) inodes (soft = 0, hard = 0)

Later if you want to copy john's quota policy to other users, the folling command will copy john's quota policy to other users user1 user2 user3.

bash-3.00$ edquota -p john user1 user2 user3 -

Examine each mounted ufs file system

bash-3.00# quotacheck -va *** Checking quotas for /dev/rdsk/c0d0s7 (/export/home) bash-3.00#

Check how much diskspace is allocated to specified user.

bash-3.00# quota -v john Disk quotas for john (uid 304): Filesystem /export/home bash-3.00# usage quota limit 1 5000 10000 timeleft files quota limit 1 0 0 timeleft

Enable quota support

bash-3.00# quotaon -v /dev/dsk/c0d0s7

/export/home: quotas turned on bash-3.00#

Note: With out enabling quota support any user who is defined in quota policy able to exceed all of the limits both soft and hard

Tesing

For testing, use dd command to create file full of zero using john account.

bash-3.00$ dd if=/dev/zero of=testfile bs=1024 count=1024

This command will create file of size 1M. But if, tried to create file approx. greater than 10 MB it will give an error warning of over disk limit.

bash-3.00$ dd if=/dev/zero of=testfile bs=1024 count=10240 quota_ufs: Warning: over disk limit (pid 22474, uid 304, inum 1287105, fs /export/home) quota_ufs: over hard disk limit (pid 22474, uid 304, inum 1287105, fs /export/home) write: Disc quota exceeded 9985+0 records in 9985+0 records out bash-3.00$

To view quota information of all users use:

bash-3.00# repquota -va /dev/dsk/c0d0s7 (/export/home): Block limits User test john -used soft hard 0 10240 5120 timeleft File limits used soft hard 0 7.0 days 0 0 0 0 0 timeleft

+- 9993 5000 10000

Sign up to vote on this title
UsefulNot useful