XFS – How to Remove a Project ID from XFS Project Quota

disk-space-utilizationquotaxfs

I successfully use xfs project (or directory) quota. However I just discovered that I am unable to remove quota information once I don't need it anymore.
For example, I had 3 projects with project id 1, 2, 3. I removed the directory of the project with id 2, and now xfs_quota continues to tell me that there is is a project with id 2, and it has quota. The reported used space is 0, which is correct since the directory was removed. This is not a real problem. Whenever I reuse project id 2 I will set new quota, but I'd still like to remove this useless information from the filesystem.

/etc/projects

1:/web/perso/usera
3:/web/perso/userc

/etc/projid

usera:1
userc:3

And here is what xfs_quota reports.

root@server # xfs_quota -xc "report -a -p -h" 
Project quota on /web (/dev/vdb1)
                        Blocks              
Project ID   Used   Soft   Hard Warn/Grace   
---------- --------------------------------- 
#0         588.3M      0      0  00 [------]
usera        5.5M    14G    14G  00 [------]
#2              0   980M     1G  00 [------]
userc      574.6M    14G    14G  00 [------]

How can I tell xfs that it does not need anymore to keep track of project id 2 ?

Best Answer

Setting limits to 0 while the project is still in /etc/{projid,projects}removes the project from metadata. After that it can be removed from /etc/{projid,projects}.

xfs_quota -x -c 'limit -p bsoft=0 bhard=0 foo' /path

I came across this by chance.

Related Topic