환경
uname -a
Linux home.kuc.or.kr 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 i686 i386 GNU/Linux

[root@ns home]# cat /var/log/dmesg | grep quota
VFS: Disk quotas vdquot_6.5.1

1) /etc/fstab 파일을 수정한다.
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

우선 home 을 쿼터를 걸려고 했으니 그 부분을 이렇게 수정함

LABEL=/home             /home                   ext3    defaults,usrquota        1 2

usrquota 가 추가되었음 ^^;

/etc/fstab 파일을 수정한 후, 설정을 반영하기 위해서 시스템을 다시 부팅시키거나 파일 시스템을 다시 마운트(remount) 시킨다.

[root@ns home]# mount -o remount /home
[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)

2) Quota 기록파일인 quota.user(또는 quota.group) 파일을 만든다.

[root@ns home]# touch /home/quota.user
[root@ns home]# chmod 600 quota.user

[root@ns home]# convertquota -u /home/
위 명령어 쳤는데 에러 뜨면 리붓 하번 해주면 됨 안되면 말고

그리고 ls -al 로 해서 대충 보면
aquota.user 이란 파일 하나 더 생김~

3) 디스크 사용 상태를 체크한다. 실행하여 이러한 작업을 할 수 있다.
[root@ns home]# quotacheck -avug  
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.
위처럼 에러 뜨면 밑에처럼 하면 됨 안되면 역시나 말고
[root@ns home]# quotacheck -avugm
quotacheck: Scanning /dev/cciss/c0d0p7 [/home] done
quotacheck: Checked 4124 directories and 40103 files

4) Quota 시작하기
[root@ns home]# quotaon /home1


계정 용량 할당 하기

[root@ns home]# edquota bresting

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)
이건 파일 게수를 뜻한 역시나 위와 같음

예를 들자면

Disk quotas for user bresting (uid 510):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/cciss/c0d0p7           50         51200          56320        10       1500     1550

50 메가 넘으면 경고 메세지 보냄
55 메가 넘으면 더이상 못씀
1500 게 파일 넘으면 경고 메세지
1550 게 파일 넘으면 더이상 못씀


유예 기간
[root@ns home]# edquota -t
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


쿼터 설정 상태

[root@ns home]# repquota -a
*** 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 `
2010/08/01 23:40 2010/08/01 23:40

Trackback Address :: https://youngsam.net/trackback/1287