Set Disk Quota2011/05/09 |
Set Disk Quota. This example shows to set it at /home
|
|
[1] | Configure |
[root@dlp ~]# vi /etc/fstab # add "usrquota" for the line like follows /dev/mapper/vg_dlp-lv_root / ext4 defaults 1 1 UUID=87d7a761-7c79-4cdf-869f-6adb50af67d9 /boot ext4 defaults 1 2 /dev/mapper/vg_data-lv_data /home ext4 defaults ,usrquota 1 2 /dev/mapper/vg_dlp-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 [root@dlp ~]# [root@dlp ~]# quotacheck -um /home # create a file for quota [root@dlp ~]# quotaon -uv /home # enable quota /dev/mapper/vg_data-lv_data [/home]: user quotas turned on [root@dlp ~]# quotaon -p -a # make sure settings group quota on /home (/dev/mapper/vg_data-lv_data) is off user quota on /home (/dev/mapper/vg_data-lv_data) is on [root@dlp ~]# edquota -u fermi # set quota for a user 'fermi' # specify quota. the example below set 1G for it Disk quotas for user fermi (uid 500): Filesystem blocks soft hard inodes soft hard /dev/mapper/vg_data-lv_data 32 1024000 1024000 8 0 0 [root@dlp ~]# repquota -a # make sure status *** Report for user quotas on device /dev/mapper/vg_data-lv_data Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 20 0 0 3 0 0 fermi -- 32 1024000 1024000 8 0 0 |
[2] | Apply a setting for a user to another user. |
[root@dlp ~]# edquota -p fermi cern # apply quota for 'fermi' to user 'cern' [root@dlp ~]# repquota -a # make sure status *** Report for user quotas on device /dev/mapper/vg_data-lv_data Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 20 0 0 3 0 0 fermi -- 32 1024000 1024000 8 0 0 cern -- 32 1024000 1024000 8 0 0 |