Thursday, June 17, 2010

Setting Up Quota in Linux

Setting up a quota in Linux is easy.
1. Install quota.

In Ubuntu:
sudo apt-get install quota

In openSUSE:
sudo yast2 -i quota

2. Add usrquota and grpquota parameters to the mount options in the /etc/fstab, e.g.
/dev/sda2  /  ext4  acl,user_xattr,usrquota,grpquota 1 1

For file systems that support journaling, such as ext3 and ext4, we need to add additional options, e.g.
/dev/sda2 / ext4 acl,user_xattr,usrjquota=aquota.user,,jqfmt=vfsv0 1 1

3. Run quotacheck -amvug
This command is used to perform a scan in the file system for disk usage as well as to create and aquota.user files. In our example, the and aquota.user files are created in / directory.

4. Run edquota -u <username>
This command is used to set a quota for a particular user. The block here means how many blocks the user can use and the inode here means how many files the user can own.

5. Run repquota -av
This command is used to give a summary on the quotas.

No comments:

Post a Comment