[CentOS] Centos 8 and xfs_quota

Fri Nov 6 19:48:32 UTC 2020
Valeri Galtsev <galtsev at kicp.uchicago.edu>


On 11/6/20 1:29 PM, david wrote:
> Folks
> 
> I'm trying to use xfs_quota to keep track of disk space usage for my 
> users.

Here is what I have:

/etc/fstab
----
LABEL=/home		/home			xfs	defaults,usrquota	1 2
----

once usrquota is in fstab, unmount and mount again /home; then you will see

# mount | grep home
/dev/sdb1 on /home type xfs (rw,usrquota)

(or similar)

To set quotas once for all users (and any users added in a future):

xfs_quota -x -c "limit bsoft=9g bhard=10g -d" /home

or make some individual quota different than already set for everyone:

xfs_quota -x -c "limit bsoft=7g bhard=8g valeri" /home


Here you should be done. In fact, you will not see quota status, 
occupancies of given user until the user writes something after the 
quotas had been set.


I hope, this helps.

Valeri

>  The documentation states that I should specify "uquota" as an 
> option on the mount data in /etc/fstab.  Yet, I cannot find the entry in 
> fstab that corresponds to the Logical Volume that ends up being mounted 
> on /home1.
> 
> The system in question was installed on a single disk system.  Later, 
> after install, I added a second disk, created a Logical Volume on it, 
> and mounted it as /home1, where all the user data gets stored.  It holds 
> an xfs file system.
> 
> Upon examining /etc/fstab, there's no evidence of the second disk, yet 
> it does get mounted:
> 
> 
> [root at ape ~]# cat /etc/fstab
> 
> #
> # /etc/fstab
> # Created by anaconda on Fri May  1 21:05:38 2020
> #
> # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
> # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more 
> info.
> #
> # After editing this file, run 'systemctl daemon-reload' to update systemd
> # units generated from this file.
> #
> /dev/mapper/cl_ape-root /                       xfs     defaults        0 0
> UUID=d5a206d6-7ea1-42b7-8f52-071e98d09f98 /boot ext4    defaults        1 2
> /dev/mapper/cl_ape-swap swap                    swap    defaults        0 0
> [root at ape ~]#
> 
> 
> Yet, when I look at the current mounts of xfs file systems:
> 
> [root at ape ~]# mount | grep xfs
> /dev/mapper/cl_ape-root on / type xfs (rw,relatime,attr2,inode64,noquota)
> /dev/mapper/vg_abcde-lv01 on /home1 type xfs 
> (rw,relatime,attr2,inode64,noquota)
> [root at ape ~]#
> 
> the LV of the second disk shows up.
> 
>   lsblk
> NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> sda               8:0    0   25G  0 disk
> +-sda1            8:1    0    1G  0 part /boot
> +-sda2            8:2    0   24G  0 part
>    +-cl_ape-root 253:0    0 21.5G  0 lvm  /
>    +-cl_ape-swap 253:1    0  2.5G  0 lvm  [SWAP]
> sdb               8:16   0  5.2T  0 disk
> +-vg_abcde-lv01 253:2    0  5.2T  0 lvm  /home1
> sr0              11:0    1  597M  0 rom
> [root at ape ~]#
> 
> 
> How do I enable quotas on a file system that is being mounted but not in 
> fstab?  I suspect systemd has a role here, but I can't find any evidence.
> 
> David
> 
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

-- 
++++++++++++++++++++++++++++++++++++++++
Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247
++++++++++++++++++++++++++++++++++++++++