« Sun Alert Patch Cluster と Recommended Patch Cluster との違い | メイン | BIND の forwarders の設定について »

2005年10月14日

ユーザごとのホームディレクトリの容量制限

/export/home 配下に各ユーザのホームディレクトリをquota の機能を使用し、制限する。

設定例 ) ファイルシステム : /export/homeユーザと制限 : aaa, bbb, ccc をそれぞれ 300 MByte

 1. /etc/vfstab を編集。

  例 ) /export/home ファイルシステムに quota の設定をする場合

   # vi /etc/vfstab
:
   /dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes rq


 2. quotas ファイルを作成し、パーミッションを変更。

  例 ) /export/home ファイルシステムに quota の設定をする場合

   # cd /export/home
   # touch quotas
   # chmod 600 quotas


 3. ユーザ毎の割り当てを設定。

例 ) aaa というユーザの弱い制限値を 300 MBytes、強い制限値 400 MBytes、
i ノード数には制限値をもうけない場合。
     ※ 強い制限値、弱い制限値については以下を参照。
http://docs.sun.com/db/doc/806-2718/6jbtrjv1b?l=ja&a=view

   # edquota aaa
:
   fs /export/home blocks (soft = 300000, hard = 400000) inodes (soft = 0, hard = 0)

   :wq!

  確認 )

   # quota -v aaa
   Disk quotas for aaa (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 300000 400000 0 0 0


 4. あるユーザの割り当てを他のユーザにも設定する場合は以下のようにして設定。

例 ) aaa の割り当てを bbb, ccc にも設定する場合

   # edquota -p aaa bbb ccc

確認 )

   # quota -v aaa bbb ccc
   Disk quotas for aaa (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 0 300000 400000 0 0 0
   Disk quotas for bbb (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 0 300000 400000 0 0 0
   Disk quotas for ccc (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 0 300000 400000 0 0 0


 5. quota の整合性を確認。

例 ) /export/home の quota の整合性を確認する場合

   # quotacheck -v /export/home

例 ) 上記 3 の値が正確なものになる

   # quota -v aaa bbb ccc
   Disk quotas for aaa (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 1 300000 400000 2 0 0
   Disk quotas for bbb (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 5 300000 400000 5 0 0
   Disk quotas for ccc (uid XXXX):
   Filesystem usage quota limit timeleft files quota limit timeleft
   /export/home 5 300000 400000 5 0 0
   #


 6. quota を有効にする。

例 ) /export/home の quota を有効にする場合

   # quotaon -v /export/home


尚、quota に関しては、下記の URL にあるマニュアルに説明が掲載されている。

http://docs.sun.com/app/docs/doc/806-2718/6jbtrjv1b?a=view
Solaris 8 System Administrator Collection - Japanese
Solaris のシステム管理 (第 2 巻)
29. ディスク割り当ての管理

投稿者 AJ : 2005年10月14日 18:04

トラックバック

このエントリーのトラックバックURL:
http://www.factory-aj.com/cgi/mtctrl/mt-tb.cgi/193

 
Powered by Movable Type 4.27-ja | RSS1.0 | RSS2.0 | ATOM