Upload
animeshdoc
View
100
Download
1
Embed Size (px)
Citation preview
Solaris Disk Quota Implementation & Management
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:
1. edquota - facilitates the creation of quotas for users 2. quotacheck - checks for consistency in usage and quota policy 3. quotaon - enables quotas on file system4. repquota - displays quota information
Steps to enable quota support
1. modify /etc/vfstab
Edit "Mount Options" column and replace '-' with 'rq'.
1. device mount FS fsck mount mount2. #to mount to fsck point type pass at boot options 3.4.5. /dev/dsk/c0d0s7 /dev/rdsk/c0d0s7 /export/home ufs 2 yes -6. to7. /dev/dsk/c0d0s7 /dev/rdsk/c0d0s7 /export/home ufs 2 yes rq
2 create empty 'quotas' file in root of desired file system
1. bash-3.00$ touch /export/home/quotas2. bash-3.00$ chmod 600 /export/home/quotas
3 Edit user quotas for ufs file system (here user is john)
bash-3.00$ edquota john
# Edit soft limit and hard limitfs /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 following command will copy john's quota policy to other users user1 user2
user3.
bash-3.00$ edquota -p john user1 user2 user3 -
4 Examine each mounted ufs file system 8. bash-3.00# quotacheck -va 9. *** Checking quotas for /dev/rdsk/c0d0s7 (/export/home)
bash-3.00#
5 Check how much diskspace is allocated to specified user.
10. bash-3.00# quota -v john 11. Disk quotas for john (uid 304):12. Filesystem usage quota limit timeleft files quota limit timeleft13. /export/home 1 5000 10000 1 0 0
bash-3.00#
6 Enable quota support 7
2. bash-3.00# quotaon -v /dev/dsk/c0d0s7 3. /export/home: quotas turned on4. 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
7 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=10240quota_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 exceeded9985+0 records in9985+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 limitsUser used soft hard timeleft used soft hard timelefttest -- 0 10240 5120 0 0 0 john +- 9993 5000 10000 7.0 days 0 0 0