Memo‎ > ‎

My procedure to enable disk quota

posted Aug 4, 2019, 9:40 AM by Teng-Yok Lee   [ updated Aug 4, 2019, 9:56 AM ]

Mount disk with quota options

The options are usrquota and grpquota. There are two ways to mount:

Option 1: Use /etc/fstab:

# In /etc/fstab:

/dev/sdb1       /data ext4      defaults,usrquota,grpquota      0       0

Reboot the computer to make it effective.

Option 2: Directly remount with the option:

$ sudo mount -o usrquota,grpquota /dev/sdb1 /data

Check the quota

NOTE: sudo is needed in order to temporally make the file system read-only. The option -cug will check both users & groups (REF).
$ sudo quotacheck -cug /data

Enable quota

$ sudo quotaon /data

Check quota

To check user-wise quota:
$ sudo repquota /data
To check group-wise quota, add the option -g:
$ sudo repquota -g /data

Edit the quota

Set the preferred editor (REF):
$ export EDITOR="emacs -nw"
Edit the quota for a specific user. Note the the env. var. should be passed via -E.
$ sudo -E edquota tlee