디스크 쿼타
; 사용자 디스크 할당 제한 (block , 파일갯수)
1. 커널지원여부
2. fstab 옵션추가 (usrquota,grpquota) : # vi /etc/fstab
3. remount (umount , mount) : # mount -o remount /home
4. 데이터베이스 파일생성(quota.user , quota.group) :
# touch quota.user
# chmod go= quota.user
# quotacheck -avum
# convertquota -u /home
5. 사용자마다 적용수치 기록 : # edquota test1
# repquota -au
(예제)
# vi /etc/fstab -- fstab 옵션 추가 입력 ( usrquota) , 그룹은 (grpquota)
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,usrquota 1 2
LABEL=/opt /opt ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
/dev/hda6 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
# /dev/cdrom /opt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
# mount -o remount /home -- 리마운트
[root@h179 patch]# mount
/dev/hda3 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
noneon/dev/ptstypedevpts(rw,gid=5,mode=620)
/dev/hda8 on /home type ext3 (rw,usrquota)
none on /dev/shm type tmpfs (rw)
/dev/hda5 on /usr type ext3 (rw)
/dev/hda2 on /boot type ext3 (rw)
/dev/hda6 on /opt type ext3 (rw)
[root@h179 patch]# cd ..
[root@h179 home]# touch quota.user -- /home 으로 와서 quota.usr 파일 생성 ( 그룹은 quota.group)
[root@h179 home]# chmod go= quota.user -- go 의 권한을 모두 뺀다 (다른 유저들이 파일내용을 볼수없도록 하기위해)
[root@h179 home]# ls -al quota.user
-rw------- 1 root root 0 5월 26 15:25 quota.user
[root@h179 home]# quotacheck -avum
-- 현재 quota 상태를 체크한다
-- avum 에서 u가 user를 뜻한다. (그룹은 -avgm 으로 한다.)
-- 오류메세지가 나면 -f 옵션을 주어 재명령한다.
quotacheck: WARNING - Quotafile /home/quota.user was probably truncated. Can't save quota settings...
quotacheck: Scanning /dev/hda8 [/home] done
quotacheck: Checked 86 directories and 387 files
[root@h179 home]# convertquota -u /home
-- quota.user 파일을 aquota.user 로 변환
-- 리눅스 쿼터 데이터파일은 aquota.user 파일을 지원하므로 변환해주어야한다. (단순복사는 안된다)
[root@h179 home]# ls
aquota.user linux1 quota.user
[root@h179 home]# repquota -au -- 사용자들의 디스크할당 정도를 출력해본다
*** Report for user quotas on device /dev/hda8
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 26256 0 0 408 0 0
linux1 -- 44 0 0 11 0 0
test -- 32 0 0 8 0 0
test1 -- 20 0 0 5 0 0
test4 -- 36 0 0 10 0 0
test5 -- 32 0 0 8 0 0
test8 -- 28 0 0 7 0 0
test9 -- 32 0 0 8 0 0
test3 -- 28 0 0 7 0 0
※ 0은 무한대를 의미
block : 현제 사용중인 블럭량(단위 : KByte)
soft : 보통의 경우 사용자가 사용할 수 있는 최대용량(사용량경고)
※ 만약 여기에 지정한 용량이 hard 에 지정한 값보다 작을 경우
hard용량까지 지정한 유예기간(grace period)동안은 초과가능
hard : 블럭 사용 제한량(단위 : KByte)
inodes : 현제 사용중인 파일 수
soft : 파일 사용량 경고
hard : 파일 사용량 제한
soft => 보통의 경우 사용자가 사용할 수 있는 최대 용량을 나타낸다. 만약 여기에 지정한 용량이 hard
에 지정한 값보다 작을 경우 hard용량까지 지정한 유예기간(grace period)동안은 초과가능
hard=> 실제 사용자가 최대로 사용할 수 있는 용량(KB)를 의미한다.
inodes=> 현재 사용중인 inode를 나타낸다.
soft=> 사용자에게 지정하는 inode의 값으로 파일또는 디렉토리를 생성할 수 있는 갯수
hard=> 절대 초과할수 없는 inode값으로 사용자가 생성할수 있는 파일 또는 디렉토리의 최대값이다.
[root@h179 home]# edquota test1 -- test1 사용자의 디스크할당을 편집한다.
[root@h179 home]# edquota -p test1 test2 test3 -- test1 사용량을 test2 test3 에 똑같이 배정
★ 디스크할당을 해줄 계정은 그 디스크내에 생성되어 있어야만 한다.
[root@h179 home]# repquota -au -- 편집된 test1의 디스크할당을 출력한다.
*** Report for user quotas on device /dev/hda8
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 26256 0 0 408 0 0
linux1 -- 44 0 0 11 0 0
test -- 32 0 0 8 0 0
test1 -- 20 1000 1500 5 10 15
test4 -- 36 0 0 10 0 0
test5 -- 32 0 0 8 0 0
test8 -- 28 0 0 7 0 0
test9 -- 32 0 0 8 0 0
test3 -- 28 0 0 7 0 0
[root@h179 home]# quotaon /home -- 디스크할당을 적용시킨다.
※ file limits - soft : 지정해준 숫자만큼 파일갯수가 늘어나면 경고메세지를 출력한다.
※ file limits - hard : 지정해준 숫자까지만 파일을 생성할수 있다
※ Block limits - 파일의 용량에 관계된다.
※ [root@h179 home]# quotaoff /home -- 디스크할당을 해제한다.
'Linux & Solaris' 카테고리의 다른 글
awstats 웹 분석툴 사용하기 (1) | 2009.08.04 |
---|---|
mysql 덤프 / 임포트 (16) | 2009.08.01 |
디스크 쿼타 지정 (0) | 2009.08.01 |
실행권한 없는 /tmp 파티션 만들기 (0) | 2009.08.01 |
리눅스 / 솔라리스 IP 변경 방법 (2) | 2009.08.01 |
SSH / FTP 등 기본 접속환경 설정(리눅스 / 솔라리스) (0) | 2009.08.01 |