How to Enable the Quota on a drive/partition in Linux

Many times it is required to enable the quota on a drive where there is mostly user data in order to check the size used by a specific user on the system. For that, we must have enabled quota on the drive.

The following are the steps using which we can enable the quota:-

Step 1: First of all make sure that the 'quota' package has been installed on the system and if not then do install it using the command below:-

yum install quota

Step 2: Go to /etc/fstab file and write usrquota next to the default against the partition on which you want to enable the quota as below :-
---------------------------------------------------------------------------------------------------------
/dev/sda1     /home     ext4    defaults,usrquota        1     1
---------------------------------------------------------------------------------------------------------

then save and quit the file.

Step 3: After this run the command below:-

mount -o remount /dev/vda2 and then run the command mount and you'll see the output as below:-

------------------------------------------------------------------------
/dev/vda2 on /home  type ext4 (rw,usrquota)
------------------------------------------------------------------------

Step 4: Now, run the command below to create the quota file:-

/sbin/quotacheck -mufv /home

Step 5: On the quota for /home partition

/sbin/quotaon /home

That's all that needs to be done. After this, you can use the command below to see the users inside the /home directory.

repquota /home

Similarly to increase/decrease the quota for a particular user, you can use the commands as below:-

edquota username

e.g. edquota sachin
--------------------------------------------------------------------------------------------------------------------------
Disk quotas for user sachin (uid 502):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/vda2                        16          0          0          5        0        0
--------------------------------------------------------------------------------------------------------------------------

That's it.

Sachin Thursday 03 October 2013 - 06:33 am | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.