쿼터 3.x(레드헷 7.1 이상) 에서 확인한 방법임
설정한 환경 사항은
Linux ns.my2pc.com 2.4.22-1.2174.nptlsmp #1 SMP Wed Feb 18 16:21:50 EST 2004 i686 i686 i386 GNU/Linux
레드헷 페도라 코어 1 버전임
VFS: Disk quotas vdquot_6.5.1
vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
대충 저리 비슷한 환경 이라고 보고
위에는 하드가 스카시라 저런 식으로 표시가 됩니다. 만약 ide 하드라면 hda1 hda2 과 같이 표시가 됩니다.
'/home' 파티션에 Quata를 설정하도록 하겠습니다. 아래과 같이 수정합니다.
usrquota 를 추가하였습니다.
[root@ns home]# mount
/dev/cciss/c0d0p5 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/cciss/c0d0p1 on /boot type ext3 (rw)
/dev/cciss/c0d0p7 on /home type ext3 (rw,usrquota)
none on /dev/shm type tmpfs (rw)
/dev/cciss/c0d0p3 on /usr type ext3 (rw)
/dev/cciss/c0d0p2 on /var type ext3 (rw)
mout 로 보면
/dev/cciss/c0d0p7 on /home type ext3 (rw,usrquota)
이렇게 되있음 쿼터 설정이 된 것입니다.
사용자의 쿼터 정보를 담고 있는 파일인 quota.user 이게 자동으로 생기지 않으면 다음과 같은 명령을 실행합니다.
[root@ns home]# chmod 600 quota.user
[root@ns home]# convertquota -u /home/
만약 위의 명령어가 제대로 실행이 안 된다면
이 부분을 먼저 실행 하고 # convertquota -u /home/ 을 실행합니다.
그리고 ls -al 로 해서 살펴보면 aquota.user 이란 파일이 생성됐을 것입니다.
quotacheck: Cannot remount filesystem mounted on /home read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.
위와 같이 에러가 발생하면 아래과 같이 입력합니다.
quotacheck: Scanning /dev/cciss/c0d0p7 [/home] done
quotacheck: Checked 4124 directories and 40103 files
Quota for users is enabled on mountpoint /home so quotacheck might damage the file.
Please turn quotas off or use -f to force checking.
위와 같은 경고 메시지를 만나면 당황하지 말고 quota를 잠시 중단하고 quotacheck를 한 후 다시 가동하면 된다.
[root@rootman /root]# quotacheck -a
[root@rootman /root]# quotaon -a
* 중요
만약 자신의 하드가 다른 물리적 파티션이거나 또는 다른 곳에서 마운트를 해왔다면 쿼터 적용이 안될 것이다. 그 부분을 위해 다른 곳도 쿼터에서 알수 있게 활성화를 시켜줘야 한다. 즉 /home 을 활성화 시킨다고 하면
라고 하면
라는 문구가 뜰것이다 만약 이미 활성화가 되었다면
이런식의 문구가 뜰 것이다. 이 부분이 제대로 되어 있지않으면 사용자 정보가 제대로 반영이 안된다. 그러므로 아무리 쿼터를 적용할려고 하지만 적용이 안되는 불상사가 생겨 버린다.
* 계정 용량 할당 하기
Disk quotas for user bresting (uid 510):
Filesystem blocks soft hard inodes soft hard
/dev/cciss/c0d0p7 3126776 0 0 598 0 0
block(soft = 0, hard=0)
block 은 지금 사용하고 있는 총 용량
soft 는 용량의 제한을 둬서 그걸 넘으면 에러 메세지를 보냄
hard 는 그 용량 되면 더이상 못씀
inodes (soft =0, hard=0)
이건 파일 게수를 뜻한 역시나 위와 같음
예를 들자면
Filesystem blocks soft hard inodes soft hard
/dev/cciss/c0d0p7 50 51200 56320 10 1500 1550
50 메가 넘으면 경고 메세지 보냄
55 메가 넘으면 더이상 못씀
1500 게 파일 넘으면 경고 메세지
1550 게 파일 넘으면 더이상 못씀
* 유예 기간
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
Filesystem Block grace period Inode grace period
/dev/cciss/c0d0p7 7days 7days
* 쿼터 설정 상태
*** Report for user quotas on device /dev/cciss/c0d0p7
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1216 0 0 141 0 0
nobody -- 37960 0 0 825 0 0
vpopmail -- 1688 0 0 181 0 0
bresting -- 3126776 0 0 598 0 0
fellen -- 26592228 0 0 1150 0 0
mysql -- 20 0 0 5 0 0
photo -- 24 0 0 6 0 0
my2pc -- 332756 0 0 2394 0 0
kang0927 -- 1410648 0 0 2713 0 0
down -- 6820940 0 0 1632 0 0
jhs1013 -- 2646524 0 0 1644 0 0
infoftp -- 9556676 0 0 1213 0 0
bibichu -- 4675392 0 0 4668 0 0
moriya -- 9892968 9900000 9950000 13858 0 0
heyworld -- 24 0 0 6 0 0
heyoh -- 8223824 0 0 75 0 0
issey -- 2285488 0 0 10063 0 0
hayan -- 1176884 0 0 1903 0 0
club -- 5672 0 0 748 0 0
쿼터 설정을 다른 사용자와 동일하게 설정 하기
edquota -p bresting bresting1 bresting2
bresting 의 환경을 bresting1 bresting2 에게 같이 적용
다중 사용자의 쿼터 적용
edquota -p bresting `awk -F: '$3 > 500 {print $1}' /etc/passwd`
awk 앞에는 숫자1 옆의 ` 그다음은 엔터 옆 ' ' passwd 는 숫자1 `
crontab -e
0 3 * * 0 /sbin/quotacheck -avugm