[精讚] [會員登入]
2196

[CentOS] 設定和使用quota

quota 的觀念已經很老了,不過每次都會忘記所以寫下來,有需要觀念的朋友請參看鳥哥的網站吧

分享此文連結 //n.sfs.tw/10669

分享連結 [CentOS] 設定和使用quota@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-23 15:53:32 最後編修
2017-01-24 01:49:14 By 張○○
 

自動目錄

系統

Centos5.4

1. 安裝 quota

  預設 centos 5.4 安裝完畢是沒有qouta 的,所以要安裝。

  # yum install quota

 要設定quota 的目錄為 /home 記得在安裝系統時一定要獨立的劃出來,否則無法設定

2. 修改 /etc/fstab

 /dev/VolGroup00/LogVo102 /home                   ext3    defaults,usrquota,grpquota        1 2

 /dev/VolGroup00/LogVo102是我設定的 logical volumn,各位如果是實體的volumn 名稱可能會不一樣。

3. remount

設定完畢後不必重開機,可以直接 runtime remount
# mount -o remount /home

查看
# mount -l

4. 掃瞄檔案系統並建立 Quota 的記錄檔

#  quotacheck -avug
quotacheck: Scanning /dev/mapper/VolGroup00-LogVo102 [/home] |
quotacheck: Cannot stat old user quota file: 沒有此一檔案或目錄
quotacheck: Cannot stat old group quota file: 沒有此一檔案或目錄
quotacheck: Cannot stat old user quota file: 沒有此一檔案或目錄
quotacheck: Cannot stat old group quota file: 沒有此一檔案或目錄
done
quotacheck: Checked 6432 directories and 88501 files
quotacheck: Old file not found.
quotacheck: Old file not found.

初始化完畢就會在想設定quota 的目錄匣下產生 aquota.group  aquota.user 兩個檔,不要理他也不要刪除。

5. 設定軟硬限制

編輯單一使用者
# edquota -u username

或編輯群組
# edquota -g usergroup

Disk quotas for user axer (uid 501):
  Filesystem                           blocks       soft       hard     inodes     soft     hard
  /dev/mapper/VolGroup00-LogVo102      14868   10000000   12000000        638        0        0

blocks 是指該使用者目前的在碟容量(block數)
   soft / hard 軟硬限制容量(KB)
inodes 檔案數量,基本上一個檔案是一個inodes
   soft / hard 軟硬限制inodes數 -- 設為容量的 1/10~ 1/20差不多

6. 啟動/關閉 quota

# quotaon -avgu
# quotaoff -a


原文 2012-03-30 13:59:20

END

你可能感興趣的文章

[CentOS 8] 無法使用: No URLs in mirrorlist error Centos8 沒辦法使用yum安裝軟體的解決方法

使用RRDTOOL來繪製流量圖 使用RRDTOOL來製作流量圖的簡略說明

Linux shell 的date表示法 linux下SHELL中的date表示法

[Centos7] 安裝php套件管理程式Composer+ Codeignioter3 很多人在用的套件管理程式 Composer+ Codeignioter3+ 指定安裝目錄

[CENTOS7] 使用 logrotate 來整理mongo日誌檔 解決 mongo 的日誌檔不斷長大的問題

SELinux 常用指令和檔案 在Redhat系列中,Centos5以後加入了selinux,他並沒有這麼可怕,不必每次看到Selinux ,就想把他

隨機好文

[CodeIgniter3] 解決無法上傳特定檔案(.sb2)的問題 上傳時出現The filetype you are attempting to upload is not allowed,要怎麼解決?

外匯課程經驗 有天遇到某個朋友的正妹朋友,說她有個很棒的外匯投資課程,要我們去聽,只收場地費200大洋。她又說續效最差一個月也有1%,誰還在苦哈哈上班?

[CodeIgniter 3] 資料庫的使用方法整理1/2 --Select的使用 [CodeIgniter 3] 資料庫的使用方法整理:Select的使用

[CodeIgniter 3] 資料庫的使用方法整理2/2 CI3 承襲 CI2,有很多的builder class可以用,依各人的使用習慣,有人喜歡一堆sql字串,有人喜歡用helper

[Wildfly10] 發佈war檔 deploy war file onto wildfly10