Memo‎ > ‎

My procedure to enable disk quota

posted Aug 4, 2019, 9:40 AM by Teng-Yok Lee   [ updated Sep 23, 2019, 10:02 PM ]

Mount disk with quota options

The options are usrquota and grpquota.

# In /etc/fstab:

/dev/sdb1       /data ext4      defaults,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv1      0       0



Remount the filesystem to make it effective:
$ sudo mount -vo remount /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

Option 1: Use setquota for command-line based editing. The usage is:

$ setquota <user> <soft-inode-limit> <hard-inode-limit> <soft-file-limit> <hard-file-limit> <file-system>

Option 2: Use edquota for interactive editing

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

Disable quota check when booting

Editing /etc/default/grub:

$ sudo emacs -nw /etc/default/grub

Append "quotacheck.mode=skip" to GRUB_CMDLINE_LINUX.

Update grub:

$ sudo update-grub

Once reboot, check /proc/cmdline to verify the kernel options.

References

https://wiki.archlinux.org/index.php/Disk_quota
https://web.mit.edu/rhel-doc/5/RHEL-5-manual/Deployment_Guide-en-US/ch-disk-quotas.html
https://www.linuxsecrets.com/archlinux-wiki/wiki.archlinux.org/index.php/Disk_quota.html#Usage
Comments