본문 바로가기
리눅스

쿼터(Quota) 설정 2

by 웹디자인 2012. 7. 20.
quota설정하기

quota : 유저가 사용할수 있는 공간을 제한 해주는 개념

* 테스트순서 *

1. /etc/fstab 설정
2. touch /home/quota.user
3. chmod 600 /home/quota.user
4. quotacheck -mf /home
-> 즉 디스크를 사용하고 있는 파일 시스템을 체크하여 quota기록 파일(quota.user또는 quota.group)을 가장최신 상태로 업데이트함
(새로운 개정을 추가하면 이명령어를 다시해줘야한다.)
5. convertquota -u /home
6. 쿼터설정 #edquota probe -> 쿼터 변경할 개정 정의
7. 쿼터확인 #repquota /home

* 따라하기 *

[root@linux233 /]# vi /etc/fstab -> 쿼터줄곳에 usrquota옵션을 추가

LABEL=/ / ext2 defaults 1 1
LABEL=/backup /backup ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults,usrquota 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
/dev/hda6 swap swap defaults 0 0
/dev/hda8 /data1 ext3 defaults 0 0
/dev/hda9 /data2 ext3 defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/hda10 swap swap defaults 0 0
~
~

[root@linux233 /]# mount -o remount /home -> 재적용
[root@linux233 /]# mount
/dev/hda1 on / type ext2 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
/dev/hda3 on /backup type ext3 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda7 on /home type ext3 (rw,usrquota)
none on /dev/shm type tmpfs (rw)
/dev/hda2 on /usr type ext3 (rw)
/dev/hda5 on /var type ext3 (rw)
/dev/hda8 on /data1 type ext3 (rw)
/dev/hda9 on /data2 type ext3 (rw)

[root@linux233 /]# cd home
[root@linux233 home]# touch quota.user
[root@linux233 home]# chmod 600 quota.user
[root@linux233 home]# quotacheck -mf /home
quotacheck: WARNING - Quotafile /home/quota.user was probably truncated. Can't save quota settings...
[root@linux233 home]# ls -al
합계 64
drwxr-xr-x 10 root root 4096 7월 30 19:59 .
drwxr-xr-x 28 root root 4096 7월 30 19:44 ..
drwxr-xr-x 2 root root 4096 7월 22 19:16 chongmoo
drwxr-xr-x 2 root root 4096 7월 22 19:16 insa
drwxr-xr-x 2 root root 4096 7월 22 19:16 jaje
drwx------ 2 root root 16384 7월 17 04:43 lost+found
drwxr-xr-x 5 root root 4096 7월 22 19:20 protoss
-rw-r--r-- 1 root root 0 7월 30 19:57 quato.user
-rw------- 1 root root 16480 7월 30 19:59 quota.user
drwxr-xr-x 9 508 terran 4096 7월 22 21:49 terran
drwx------ 6 wish wish 4096 7월 30 19:56 wish
drwxr-xr-x 6 root root 4096 7월 22 20:14 zerg
[root@linux233 home]# convertquota -u /home
[root@linux233 home]# ls -al
합계 72
drwxr-xr-x 10 root root 4096 7월 30 19:59 .
drwxr-xr-x 28 root root 4096 7월 30 19:44 ..
-rw------- 1 root root 8192 7월 30 19:59 aquota.user
drwxr-xr-x 2 root root 4096 7월 22 19:16 chongmoo
drwxr-xr-x 2 root root 4096 7월 22 19:16 insa
drwxr-xr-x 2 root root 4096 7월 22 19:16 jaje
drwx------ 2 root root 16384 7월 17 04:43 lost+found
drwxr-xr-x 5 root root 4096 7월 22 19:20 protoss
-rw-r--r-- 1 root root 0 7월 30 19:57 quato.user
-rw------- 1 root root 16480 7월 30 19:59 quota.user
drwxr-xr-x 9 508 terran 4096 7월 22 21:49 terran
drwx------ 6 wish wish 4096 7월 30 19:56 wish
drwxr-xr-x 6 root root 4096 7월 22 20:14 zerg
[root@linux233 home]#


[root@linux233 home]# repquota /home
*** Report for user quotas on device /dev/hda7
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1684 0 0 21 0 0
wish -- 1572 0 0 21 0 0
medic -- 64 0 0 15 0 0
dragon -- 64 0 0 15 0 0
zealot -- 60 0 0 14 0 0
probe -- 60 0 0 14 0 0
drone -- 60 0 0 14 0 0
hydra -- 60 0 0 14 0 0
lurker -- 60 0 0 14 0 0
ohyeah -- 60 0 0 14 0 0
joshua -- 60 0 0 14 0 0
testman -- 68 0 0 16 0 0
#508 -- 252 0 0 59 0 0


hard를 절대 넘을 수 없고 soft는 넘을 수 있다.


[root@linux233 home]# edquota probe
Disk quotas for user probe (uid 506):
Filesystem blocks soft hard inodes soft hard
/dev/hda7 60 0 0 14 0 0 ->지정하는 단위는 기본으로 kbyte이다


이렇게 변경
Disk quotas for user probe (uid 506):
Filesystem blocks soft hard inodes soft hard
/dev/hda7 60 10000 12000 14 0 0
~
즉 soft를 10매가, hard는 12매가로 쿼터를 재정의

[root@linux233 home]# repquota /home
*** Report for user quotas on device /dev/hda7
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1684 0 0 21 0 0
wish -- 1572 0 0 21 0 0
medic -- 64 0 0 15 0 0
dragon -- 64 0 0 15 0 0
zealot -- 60 0 0 14 0 0
probe -- 60 10000 12000 14 0 0
drone -- 60 0 0 14 0 0
hydra -- 60 0 0 14 0 0
lurker -- 60 0 0 14 0 0
ohyeah -- 60 0 0 14 0 0
joshua -- 60 0 0 14 0 0
testman -- 68 0 0 16 0 0
#508 -- 252 0 0 59 0 0

주. probe 라는 사용자가 최대 12 매가 까지는 저장할수 있으나 10매가 이상(soft)값을 넘고
grace값에 정의된 날이 지나면 경고메세지와 함께 다음 부터는 soft값이하가 될때까지 업로드를 못하게 한다




**
probe 계정과 hydra lurker 계정을 같은 쿼터로 정의하는 법

[root@linux233 home]# edquota -p probe hydra lurker
[root@linux233 home]# repquota /home
*** Report for user quotas on device /dev/hda7
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1684 0 0 21 0 0
wish -- 1572 0 0 21 0 0
medic -- 64 0 0 15 0 0
dragon -- 64 0 0 15 0 0
zealot -- 60 0 0 14 0 0
probe -- 60 10000 12000 14 0 0
drone -- 60 0 0 14 0 0
hydra -- 60 10000 12000 14 0 0
lurker -- 60 10000 12000 14 0 0
ohyeah -- 60 0 0 14 0 0
joshua -- 60 0 0 14 0 0
testman -- 68 0 0 16 0 0
#508 -- 252 0 0 59 0 0


**
자기 자신의 쿼타확인하는 법

[root@linux233 home]# quota
Disk quotas for user root (uid 0): none
You have new mail in /var/spool/mail/root
[root@linux233 home]# quota probe
Disk quotas for user probe (uid 506):
Filesystem blocks quota limit grace files quota limit grace
/dev/hda7 60 10000 12000 14 0 0

 

'리눅스' 카테고리의 다른 글

메일계정 추가하기 (요약)  (0) 2012.07.20
메일계정 추가 세팅 방법  (0) 2012.07.20
쿼터(Quota) 설정 1번  (0) 2012.07.20
도메인 셋팅후 데몬 재실행  (0) 2012.07.20
vi 사용법  (0) 2012.07.20

댓글