歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> Unix基礎知識 >> 如何配置AIX的磁盤限額

如何配置AIX的磁盤限額

日期:2017/3/3 15:21:14   编辑:Unix基礎知識

操作系統版本:

testterm1:/#oslevel -r

5300-00

磁盤限額系統,它基於Berkeley磁盤限額系統,提供了控制使用磁盤空間的有效方式。為個人用戶或組定 義限額系統,並且為每一類文件系統維護限額系統。

磁盤限額系統基於下列參數建立限額,可使用eduqota命令更改這些參數:

. 用戶或組的軟限額

. 用戶或組的硬限額

. 限額寬延時間

1、為某個文件系統啟用用戶和組限額,使用chfs命令。(本文以/home文件系統為例)

testterm1:/#chfs -a "quota=userquota,groupquota" /home

上述命令實質是在/etc/filesystems文件中/home文件系統定義節中增加了quota字段,如下紅色部分:

/home:

dev = /dev/hd1

vfs = jfs

log = /dev/hd8

mount = true

check = true

vol = /home

free = false

quota = userquota,groupquota

2、指定磁盤限額文件名稱

quota.user和quota.group文件名稱是缺省名稱,位於已應用磁盤限額文件系統的根目錄下。

testterm1:/#chfs -a "userquota=/home/myquota.user" -a "groupquota=/home/myquota.group" /home

上述命令實質是在/etc/filesystems文件中/home文件系統定義節中增加了userquota和groupquota字段, 如下紅色部分:

/home:

dev = /dev/hd1

vfs = jfs

log = /dev/hd8

mount = true

check = true

vol = /home

free = false

quota = userquota

userquota = /home/myquota.user

groupquota = /home/myquota.group

3、產生磁盤限額文件

testterm1:/home#quotacheck -a -v

*** Checking user and group quotas for /dev/hd1 (/home)

Creating quota file /home/myquota.user

/home: root fixed: inodes 0 -> 784 blocks 0 -> 2100834

/home: bin fixed: inodes 0 -> 1 blocks 0 -> 1

/home: guest fixed: inodes 0 -> 1 blocks 0 -> 1

/home: netinst fixed: inodes 0 -> 20 blocks 0 -> 57

/home: hlrterm fixed: inodes 0 -> 493 blocks 0 -> 42386

/home: quan fixed: inodes 0 -> 2 blocks 0 -> 2

/home: 1000 fixed: inodes 0 -> 111 blocks 0 -> 1234

/home: 4050-109 User id 4294967294 (nobody) is too large, quotas are not maintained

Creating quota file /home/myquota.group

/home: system fixed: inodes 0 -> 787 blocks 0 -> 2100853

/home: staff fixed: inodes 0 -> 22 blocks 0 -> 58

/home: bin fixed: inodes 0 -> 1 blocks 0 -> 1

/home: usr fixed: inodes 0 -> 1 blocks 0 -> 1

/home: hlrterm fixed: inodes 0 -> 490 blocks 0 -> 42368

/home: 513 fixed: inodes 0 -> 111 blocks 0 -> 1234

/home: 4050-109 User id 4294967294 (nobody) is too large, quotas are not maintained

此時會在/home文件系統根目錄下產生myquota.user和myquota.group兩個文件:

testterm1:/home#ls -l /home/myquota*

-rw-r----- 1 root system 16448 Aug 15 22:15 /home/myquota.group

-rw-r----- 1 root system 32032 Aug 15 22:15 /home/myquota.user

每次修改限額配置之後,一定要執行quotacheck -a -v 命令。

4、設置磁盤限額對某個用戶生效(本文以quan用戶為例)

testterm1:/#edquota -u quan

查看本欄目更多精彩內容:http://www.bianceng.cn/OS/unix/

修改相應的值,保存退出。

注:組可用-g參數。

5、查看某個文件系統中對用戶磁盤限額情況(本文以/home文件系統為例)

testterm1:/#repquota -u /home

Block limits File limits

User used soft hard grace used soft hard grace

root -- 2100834 0 0 784 0 0

bin -- 1 0 0 1 0 0

guest -- 1 0 0 1 0 0

netinst -- 57 0 0 20 0 0

hlrterm -- 42386 0 0 493 0 0

quan -- 2 10240 10290 2 5 55

1000 -- 1234 0 0 111 0 0

上述結果可知,quan用戶磁盤限額為10240KB(即10M),最大可建立5個文件。

注:組可用-g參數。

6、在系統啟動後自動檢測並打開磁盤限額

修改/etc/rc 文件,在結尾增加以下行:

echo "Starting Disk Quota Service…"

/usr/sbin/quotacheck -a

/usr/sbin/quotaon -a

echo "Disk Quota started! "

7、用戶磁盤限額配置復制

要為用戶test建立限額,用已經為用戶quan建立好的限額作為原型,可輸入:

testterm1:/#edquota -u -p quan test

檢查是否成功復制:

testterm1:/#repquota -u /home

Block limits File limits

User used soft hard grace used soft hard grace

root -- 2100834 0 0 784 0 0

bin -- 1 0 0 1 0 0

guest -- 1 0 0 1 0 0

netinst -- 57 0 0 20 0 0

hlrterm -- 42386 0 0 493 0 0

test -- 2 10240 10290 2 5 55

quan -- 2 10240 10290 2 5 55

1000 -- 1234 0 0 111 0 0

由紅分部分可知,磁盤限額已成功復制。

8、使quota生效

quotaon /home

Copyright © Linux教程網 All Rights Reserved