CentOS 5
Sponsored Link

Set Disk Quota2010/05/05

  Set Disk Quota. This example shows to set it at /home.

[root@dlp ~]#
vi /etc/fstab


# add 'usrquota' at the end of line of /home

/dev/Xen/Host00
/
ext3
defaults
1 1

LABEL=/boot
/boot
ext3
defaults
1 2

devpts
/dev/pts
devpts
gid=5,mode=620
0 0

tmpfs
/dev/shm
tmpfs
defaults
0 0

proc
/proc
proc
defaults
0 0

sysfs
/sys
sysfs
defaults
0 0

/dev/Xen/Host02
/home
ext3
defaults
,usrquota
1 2

/dev/Xen/Host01
swap
swap
defaults
0 0


[root@dlp ~]#
# reboot


[root@dlp ~]#
quotacheck -um /home
# create quota file

[root@dlp ~]#
quotaon -uv /home
# enable disk quota

/dev/mapper/Xen-Host02 [/home]: user quotas turned on
[root@dlp ~]#
quotaon -p -a
# show status

group quota on /home (/dev/mapper/Xen-Host02) is off
user quota on /home (/dev/mapper/Xen-Host02) is on
[root@dlp ~]#
edquota -u cent
# set user quota to a user 'cent'


# specify quota. the example below set 100M for it

Disk quotas for user cent (uid 501):
  Filesystem
blocks
  soft
hard
 inodes
  soft
hard

/dev/mapper/Xen-Host02
16
 
102400
102400
 4
  0
0


[root@dlp ~]#
# show status

*** Report for user quotas on device /dev/mapper/Xen-Host02
Block grace time: 7days; Inode grace time: 7days
 Block limits   File limits
User
used
  soft
hard
grace
  used
soft
hard
grace

----------------------------------------------------------------------
root
--
154220
  0
0
  3
0
0

sles
--
16
  0
0
  4
0
0

cent
--
16
102400
102400
  4
0
0
[2] Apply a setting for a user to other all users.
[root@dlp ~]#
edquota -p cent sles
# apply quota for 'cent' to user 'sles'

[root@dlp ~]#
# show status

*** Report for user quotas on device /dev/mapper/Xen-Host02
Block grace time: 7days; Inode grace time: 7days
 Block limits   File limits
User
used
  soft
hard
grace
  used
soft
hard
grace

----------------------------------------------------------------------
root
--
154220
  0
0
3
0
0

sles
--
16
  102400
102400
4
0
0

cent
--
16
  102400
102400
4
0
0
Matched Content