Você está na página 1de 5

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 device mount FS fsck mount


mount

#to mount to fsck point type pass at boot


options

/dev/dsk/c0d0s7 /dev/rdsk/c0d0s7 /export/home ufs 2 yes


-

to

/dev/dsk/c0d0s7 /dev/rdsk/c0d0s7 /export/home ufs 2 yes


rq

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 usage quota limit timeleft files quota limit timeleft

/export/home 1 5000 10000 1 0 0

bash-3.00#

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 File limits

User used soft hard timeleft used soft hard timeleft

test -- 0 10240 5120 0 0 0

john +- 9993 5000 10000 7.0 days 0 0 0

Você também pode gostar