Linux disk quotas — fstab, quotacheck, edquota, journaled quota

Contents

  1. 1. Disk quotas
    1. 1.1. quota
    2. 1.2. quotaon
    3. 1.3. quotaoff
    4. 1.4. edquota
    5. 1.5. quota
    6. 1.6. repquota
    7. 1.7. warnquota
    8. 1.8. setquota
    9. 1.9. journaled quota
    10. 1.10. mdadm
    11. 1.11. LVM

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

Disk quotas

One-shot enable:
mount -o remount,usrquota,grpquota # matches /etc/mtab

Persist across boots — edit /etc/fstab
UUID=XXX ext4 defaults,usrquota,grpquota 0 0
umount
mount -a
mount | grep # confirm quota options

quota

  • -auvg — scan filesystems that need quotas [a: from /etc/mtab; u: user; g: group]
  • -mf — force check and write quota files

quotaon

  • -avug — enable quotas the first time

quotaoff

  • -aug

edquota

  • -u user — edit user limits
  • -g group — edit group limits
  • -t — grace period
  • -p template-user -u new-user — copy limits from a template

Limits are in kilobytes.

quota

  • -u user — show user quota
  • -v — all users on the filesystem
  • -g group — group quota
  • -s — human-readable (MB) output

repquota

  • -auvgs — report for the whole filesystem

warnquota

  • Emails root and affected users when usage crosses thresholds

  • Run daily

      echo "/usr/sbin/warnquota" > /etc/cron.daily/warnquota
      chmod 755 /etc/cron.daily/warnquota
    

setquota

setquota [-u|-g] [-rm] [-F quotaformat] <user|group> <block-softlimit> <block-hardlimit> <inode-softlimit> <inode-hardlimit> -a|<filesystem>...
setquota [-u|-g] [-rm] [-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...
setquota [-u|-g] [-rm] [-F quotaformat] -b [-c] -a|<filesystem>...
setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...
setquota [-u|-g] [-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...

journaled quota

quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
yum install quota

Edit: /etc/fstab

vi /etc/fstab

replace “defaults” with “usrjquota=quota.user,jqfmt=vfsv0” for / mount point

Before:

UUID=ac567666-9385-4ef5-885c-80f61ec64647 / ext3 defaults 1 1

After Replace:

UUID=ac567666-9385-4ef5-885c-80f61ec64647 / ext3 usrjquota=quota.user,jqfmt=vfsv0 1 1

mount -o remount /
quotacheck -avugm
quotaon -avug

If you have /home in /etc/fstab then you will need to edit line matching /home
replace “defaults” with “usrjquota=quota.user,jqfmt=vfsv0” for /home mount point

Before:

UUID=ac567666-9385-4ef5-885c-80f61ec64647 /home ext3 defaults 1 1

After Replace:

UUID=ac567666-9385-4ef5-885c-80f61ec64647 /home ext3 usrjquota=quota.user,jqfmt=vfsv0 1 1

mount -o remount /home
quotacheck -avugm
quotaon -avug

Now you need to add this into the CWP Configuration

mkdir -p /usr/local/cwp/.conf/
echo "/home" > /usr/local/cwp/.conf/quota_part.conf

How to check if quota works ?

repquota -a
This will display you user limits

Also: for group quotas add grpjquota=aquota.group.

Reference: How to setup user quotas

mdadm

  • RAID

LVM

Questions? Leave a comment below or email: newbvirgil@gmail.com