Advertisement
shokti

ubuntu 12.04 - disk quota

Oct 23rd, 2012
1,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. install quota program:
  2. sudo apt-get install quota quotatool
  3.  
  4. edit /etc/fstab:
  5. sudo nano /etc/fstab
  6.  
  7. add usrquota and grpquota in the filesystem where you want to enforce it. it should look like below:
  8. # / was on /dev/sda1 during installation
  9. UUID=0229ace1-de12-4cfc-83cf-990dde59f043 / ext4 errors=remount-ro,usrquota,grpquota 0 1
  10.  
  11. Restart/Reboot computer:
  12. sudo reboot
  13.  
  14. After Restart check in the root(/) if aquota.user and aquota.group is present. During restart quotacheck and quotaon comand was executed. which means after restart disk quota is running:
  15. cd /
  16. ls -al
  17.  
  18. To set or change quota size to a user, use edquota command:
  19. sudo edquota -u the_username_here
  20.  
  21. change soft(kbytes) - size in kb where when the soft quota is reached, it will start the warning until the time grace period but will not exceed the hard quota.
  22. change hard(kbytes) - size in kb where the user should not exceed.
  23.  
  24. To modify default grace period:
  25. sudo edquota -t
  26.  
  27. To check users and quota data with repquota command:
  28. sudo repquota -u /
  29.  
  30. ---------------------------------------------------------------------------------------------
  31. USEFUL DISK QUOTA COMMANDS:
  32.  
  33. run quotacheck command to prepare filesystem for quota:
  34. sudo quotacheck -mavug
  35.  
  36. options:
  37. m - don't try to remount the filesystem
  38. a - all filesystems in /etc/mtab
  39. v - verbose, display extra information
  40. u - only user quotas listed in /etc/mtab
  41. g - only group quotas listed in /etc/mtab
  42.  
  43. turn quotas on with quotaon command:
  44. sudo quotaon -avug
  45.  
  46. turn quotas off with quotaoff command:
  47. sudo quotaoff -avug
  48.  
  49. options for quotaon and quotaoff:
  50. a - all filesystems in /etc/fstab with quotas
  51. v - verbose, display extra information
  52. u - users, manipulate user quotas
  53. g - groups, manipulate group quotas
  54.  
  55. if you have a desktop environment then logout and switch to tty1(ctrl+alt+f1) to avoid some errors when running quota command, and then after running the command switch back tty7(ctrl+alt+f7) and login back to your desktop:
  56.  
  57. ---------------------------------------------------------------------------------------------
  58. DISK QUOTA FOR A MOUNTED DRIVE(ex. /home):
  59.  
  60. if you want to enforce quota on a partition other than the root(/), for example another drive with mount point /home:
  61.  
  62. edit /etc/fstab and put usrquota and grpquota in /home mount point:
  63. # /home was on /dev/md0 during installation
  64. UUID=********** /home ext4 defaults,errors=remount-ro,usrquota,grpquota 0 2
  65.  
  66. Restart/Reboot computer:
  67. sudo reboot
  68.  
  69. After Restart check in the /home folder if aquota.user and aquota.group is present. During restart quotacheck and quotaon comand was executed. which means after restart disk quota is running:
  70. cd /home
  71. ls -al
  72.  
  73. To set or change quota size to a user, use edquota command:
  74. sudo edquota -u the_username_here
  75.  
  76. change soft(kbytes) - size in kb where when the soft quota is reached, it will start the warning until the time grace period but will not exceed the hard quota.
  77. change hard(kbytes) - size in kb where the user should not exceed.
  78.  
  79. To modify default grace period:
  80. sudo edquota -t
  81.  
  82. To check users and quota data with repquota command:
  83. sudo repquota -u /home
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement