★사용자 용량 확인
k6@psh:~$ du -sh ~ 현재 사용 용량
32K /home/k6
k6@psh:~$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 198M 1.1M 197M 1% /run
/dev/sda4 12G 4.3G 6.9G 39% /
tmpfs 988M 0 988M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda2 974M 130M 777M 15% /boot
/dev/sda5 4.9G 3.6G 1.1G 77% /home
/dev/sda6 9.8G 24K 9.3G 1% /data
tmpfs 198M 4.0K 198M 1% /run/user/1000
tmpfs 198M 4.0K 198M 1% /run/user/1001
tmpfs 198M 4.0K 198M 1% /run/user/1002
tmpfs 198M 4.0K 198M 1% /run/user/1006
4.9G /home 에서 500메가 넘는 파일 찾기!
root@psh:~# find / -size +500M -exec ls -al {} \;
-rw-rw-r-- 1 k2 k2 3758096384 Apr 28 01:30 /home/k2/a2
-r-------- 1 root root 140737471590400 Apr 28 00:56 /proc/kcore
find: ‘/proc/3545/task/3545/fd/6’: No such file or directory
root@psh:~# rm -rf /home/k2/a2
★제어하기 quota
root@psh:~# vi /etc/fstab
(12번째 줄에 /home에 usrquota 추가) >> 기본 설정
root@psh:~# mount | grep /home
/dev/sda5 on /home type ext4 (rw,relatime)
root@psh:~# mount -o remount /home
root@psh:~# mount | grep /home
/dev/sda5 on /home type ext4 (rw,relatime,quota,usrquota)
root@psh:~# ls /home
it1 it2 it3 j k1 k2 k5 k6 lost+found
root@psh:~# quotacheck -aug >>쿼타 켜
root@psh:~# ls /home
aquota.user it1 it2 it3 j k1 k2 k5 k6 lost+found
=>aquota.user 쿼타를 설정하는 파일
root@psh:~# repquota -a >>쿼타 내용보
*** Report for user quotas on device /dev/sda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 24 0 0 3 0 0
j -- 28 0 0 10 0 0
k2 -- 24 0 0 7 0 0
it1 -- 28 0 0 7 0 0
it2 -- 28 0 0 7 0 0
it3 -- 64 0 0 17 0 0
k6 -- 32 0 0 9 0 0
root@psh:~# repquota -t k6 >>k6 쿼타 수정
소프트 20000블럭 // 20M
hard 25000블럭 수정하기 //25M
root@psh:~# repquota -a
*** Report for user quotas on device /dev/sda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 24 0 0 3 0 0
j -- 28 0 0 10 0 0
k2 -- 24 0 0 7 0 0
it1 -- 28 0 0 7 0 0
it2 -- 28 0 0 7 0 0
it3 -- 64 0 0 17 0 0
k6 -- 32 20000 25000 9 0 0
끝, k6가서 확인하기
k6@psh:~$ whoami
k6
k6@psh:~$ du -sh ~
36K /home/k6
k6@psh:~$ quota
Disk quotas for user k6 (uid 1006):
Filesystem blocks quota limit grace files quota limit grace
/dev/sda5 36 20000 25000 10 0 0
*실습*
root@psh:~# edquota -u it1
it1 용량제어하기
root@psh:~# repquota -a
*** Report for user quotas on device /dev/sda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 24 0 0 3 0 0
j -- 28 0 0 10 0 0
k2 -- 24 0 0 7 0 0
it1 -- 28 50000 60000 7 0 0
it2 -- 28 0 0 7 0 0
it3 -- 64 0 0 17 0 0
k6 +- 25000 20000 25000 6days 26 0 0
root@psh:~# edquota -p it1 it2 it3 //it1 quota내용을 it2, it3에 복사
root@psh:~# repquota -a
*** Report for user quotas on device /dev/sda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 24 0 0 3 0 0
j -- 28 0 0 10 0 0
k2 -- 24 0 0 7 0 0
it1 -- 28 50000 60000 7 0 0
it2 -- 28 50000 60000 7 0 0
it3 -- 64 50000 60000 17 0 0
k6 +- 25000 20000 25000 6days 26 0 0