Wednesday 23 November 2011

How to enable Quota in HP UX ?

Note: Thanks to Shameer For sharing this Tips.


Enable the HPUX default quota by following steps:


For each file system for which quotas are to be enabled, perform the following tasks:
1. Mount the file system.
2. Add quota to the existing options list in /etc/fstab. For
example, change the string default for the root (/) entry to
default,quota. Once this is done, quotas will automatically
be enabled for all relevant file systems on system reboot.
3. Create the quotas file in the mount directory of the file
system. For example, for the /mnt file system, run the
command
cpset /dev/null /mnt/quotas 600 root bin
4. Establish one or more prototype user quotas using the
edquota command (see edquota(1M)).
If you want a number of users on your system to have the
same limits, use edquota to set those quotas for a prototype
user; then use the edquota -p command to replicate those
limits for that group of users.
5. Turn on the quotas on the file system using quotaon. For
example, run the command
/usr/sbin/quotaon /mnt
6. Run quotacheck (see quotacheck(1M)) on the file system to
record the current usage statistics.

Adding a new user

To add a new user to the quota system:
1. Use edquota to copy the quotas of an existing user.
2. Run quotacheck.

Adding a new file system to an established system

Repeat steps 1 through 5 above under "Initial Setup" for the new file
system.

======================================================================================


We can enable the HPUX default quota by following steps:

1) mount the corresponding file system using the quota option

2) Activate the quota.
2) specify users with the quota limit for the file system

I'm hereby giving an example of enabling quota for my user id user1.

STEP: 1. Mount the file system in quota mode.

# mount |grep quota
/quotatest on /dev/vg00/lv_test quota,delaylog on Wed Oct 19 16:13:39 2011
#

STEP :2 Edit the quota for the user ( inthis example for user1)

serverA {root}# edquota user1
"/var/tmp/EdP.a18825" 1 line, 71 characters
fs /quotatest blocks (soft = 1024, hard = 2048) inodes (soft = 0, hard = 0)
~
"/var/tmp/EdP.a18825" 1 line, 76 characters

STEP 3 : Check the quota status.

# quota -v
Disk quotas for user1 (uid 44312):
Filesystem usage quota limit timeleft files quota limit timeleft
/quotatest 7 1024 2048 3 0 0


STEP 4 : Create test files to increase the usage for the user "user1" in the specific file system. Warning message will be displayed if the soft limit is crossed.

#cd /quotatest/user1

# ls -lrt
total 14
-rw-r----- 1 user1 osg 6000 Oct 19 16:22 testfile
-rw-r----- 1 user1 osg 500 Oct 19 16:23 testfile3

# prealloc testfile4 50000000
msgcnt 6 vxfs: mesg 044: vx_bsdquotaupdate - warning: /quotatest file system user 44312 disk quota exceeded
prealloc: Disk quota exceeded

# quota -v
Disk quotas for user1 (uid 44312):
Filesystem usage quota limit timeleft files quota limit timeleft
/quotatest 937 1024 2048 6 0 0


STEP 5 : Create test files to increase the usage for the user "user1" in the specific file system to cross the threshold. Error message will be displayed if the
hard limit is crossed that the quota is exceeded.

# prealloc testfile7 450000
msgcnt 10 vxfs: mesg 044: vx_bsdquotaupdate - warning: /quotatest file system user 44312 disk quota exceeded

# ls -lrt
total 2752
-rw-r----- 1 user1 osg 6000 Oct 19 16:22 testfile
-rw-r----- 1 user1 osg 500 Oct 19 16:23 testfile3
-rw-r----- 1 user1 osg 50000 Oct 19 16:34 testfile4
-rw-r----- 1 user1 osg 450000 Oct 19 16:36 testfile5
-rw-r----- 1 user1 osg 450000 Oct 19 16:37 testfile6
-rw-r----- 1 user1 osg 450000 Oct 19 16:37 testfile7

# quota -v
Disk quotas for user1 (uid 44312):
Filesystem usage quota limit timeleft files quota limit timeleft
/quotatest 1377 1024 2048 7.0 days 7 0 0

No comments:

Post a Comment