Memo-migrated‎ > ‎

My procedure to enable disk quota

posted Aug 4, 2019, 9:40 AM by Teng-Yok Lee   [ updated Jan 2, 2021, 7:25 PM ]

Mount disk with quota options

The options are usrquota and grpquota.

# In /etc/fstab:

/dev/sdb1       /data ext4      defaults,usrjquota=aquota.user,,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.