\\
**[[cluster:0|Back]]**
===== XFS quotas =====
In XFS you first enable quotas on the mountpoint \\
(you add the options to /etc/fstab and remount)
# user and group quotas example:
/dev/mapper/VolGroup00-lvhome /home xfs defaults,usrquota,grpquota 0 1
# user and project quotas example:
/dev/sdb1 /mindstore xfs defaults,uquota,pquota 1 2
After that you apply quotas per user, group or project.
To apply quotas to a directory (other than $HOME) create a project.
For projects you edit (for example for this lab):
# /etc/projects add a line (the "id" needs to unique)
11:/mindstore/mindlab
# /etc/projid add a line
mindstore_mindlab:11
# next initialize the project (it can already exist on disk)
xfs_quota -x -c 'project -s mindstore_mindlab'
And apply 20T quota for example
xfs_quota -x -c 'limit -p bsoft=21000000m bhard=21470000m \
isoft=20000000 ihard=21000000 mindstore_mindlab' /mindstore
Never shrink a file system (or partition). You can use ''xfs_growfs'' to enlarge a mounted XFS file system if needed. Or with lvm2 allocate all available space ''lvextend -l +100%FREE lvm_volume_pat''. Quotas you can "reduce", but be careful, not a best practice.
To keep the XFS file system healthy unmount it and remount it so the journal does its thing. Use ''xfs_repair'' for forced consistency checks (-n for no modify mode)
Automate quota checks and notification, here is a simple script
#!/bin/bash
/usr/sbin/repquota -s /home > /root/homedirs/repquota.log
d=`date +%d`
awk '{print $3","$1}' /root/homedirs/repquota.log | grep G | sed 's/G/ G/g' | sort -rn > /root/homedirs/$d.txt
foo=""
foo=`grep '+' /root/homedirs/repquota.log | wc -l`;
if [ $foo -gt 0 ]; then
foofoo=`head -5 /root/homedirs/repquota.log`
grep '+' /root/homedirs/repquota.log | mail -s "CLUSTER QUOTA REPORT" hmeij
fi
\\
**[[cluster:0|Back]]**