1. Enable quota check on filesystemFirst, you should specify which filesystem are allowed for quota check. Modify the /etc/fstab, and add the keyword usrquota and grpquota to the corresponding filesystem that you would like to monitor. The following example indicates that both user and group quota check is enabled on /home filesystem # vim /etc/fstab UUID=4ea80ca3-37b7-447e-831a-700a38627029 /home ext4 defaults,usrquota,grpquota 1 2 or /dev/hda1 /home ext4 defaults,usrquota,grpquota 1 2 Reboot the server after the above change. While rebooting it will take some time (only one time) to enable usrquota, grpquota on the /home filesystem. So wait. 2. Initial quota check on Linux filesystem using quotacheckOnce you’ve enabled disk quota check on the filesystem, collect all quota information initially as shown below. For that you may need to install the following packages. # apt-get install quota quotatool # quotacheck -avug quotacheck: Scanning /dev/sda3 [/home] done quotacheck: Checked 5182 directories and 31566 files quotacheck: Old file not found. quotacheck: Old file not found. In the above command:
The above command will create a aquota file for user and group under the filesystem directory as shown below. # ls /home/ aquota.user aquota.group # quotaon -avug 3. Install webmin gui to control hdd quota for the users & groupsFirst install the dependencies as shown below # apt-get install apt-show-versions For Ubuntu 12.04 you can download the webmin deb file from the below link http://sourceforge.net/projects/webadmin/files/webmin/1.620/webmin_1.620_all.deb/download and install as follows # dpkg -i webmin_1.620_all.deb Once you installed you can access the webmin in your browser at either https://localhost:10000/ or it will give you hostname as like below. You can download other os distro binary and source files from the below link. http://sourceforge.net/projects/webadmin/files/webmin/ 4. Open webmin guinow log into webmin & search ‘quota’ you should see a result called “Disk Quotas” click on it and press enable quotas on /home now u can create/set hdd quotas like soft, hart limits & grace time for each users, groups… Soft limit : Actual size that you are allocating to the user/group 5. Notify the used home size & quota status report to the user when they login into the shell/terminalFinally :- add the below lines in the # vim /etc/bash.bashrc to show the users quota information with their limit & used space whenever they login to the shell/terminal. echo "Your home directory quota information "quota -us $USERecho "Try to keep space < quota. You cant exceed the limit " |
Home > Server config >