Recreate XFS quotas

TL;DR: If you know the old quotas and how you set them up initially you just need to recreate them so that they are taken into account again into the new filesystem. This script is for not having to do it manually and it only covers the hard limits not the soft ones.


We needed to migrate a big XFS filesystem from one virtual machine to another virtual machine. The original XFS system did have project quotas enabled and we wanted to preserve them.

Actually we were not migrating the XFS filesystem but all the system so that meant some key files specific to XFS were already there:


However when we run:

/usr/sbin/xfs_quota -x -c "report -h /backup"

there were no sign of the old quotas.

Migrating filesystem metadata

This step should not be needed but I mention it just in case it matters.

In the origin server you need to run:

xfs_quota -x -c "dump -p -f project_limits"

Then you copy the project_limits file to the destination server and there we run:

xfs_quota -x -c "restore -p -f project_limits"


This makes the report subcommand to show the quotas but without the used space.

Forcing project used quotas to be shown

First of all we need an output of:

/usr/sbin/xfs_quota -x -c "report -h ${QUOTA_DIR}"

from the old server trimmed a little bit so that it is something like:

backup1       3,4G      0    50G  00 [------]
backup2     337,8M      0    50G  00 [------]
backup3     185,7G      0   300G  00 [------]
backup4       2,5T      0   3,3T  00 [------]
backup5       1,0T      0   1,3T  00 [------]

saved into a file named as:



Then we need this new script (adapts paths and filenames where needed) which I named


function getQuota () {

cat "${QUOTAS_OUTPUT}" | awk '$1 == "'$1'" {print $4}'


cat /etc/projid | sort | uniq | tail -n +2 \
| ( IFS=":" ; while read quotaname quotaid ; do

QUOTA="$(getQuota ${quotaname})"
QUOTA="$(echo ${QUOTA} | sed 's/,/./g' )"
#cat << EOF

xfs_quota -x -c "project -s ${PROJECTID}" ${XFS_MOUNT_PARTITION}
xfs_quota -x -c "limit -p bhard=${QUOTA} ${PROJECTID}" ${XFS_MOUNT_PARTITION}



We give it execution permissions and we run it.

The process will detect the new files for each project and it will update the used quotas per project accordingly.

Levitra 10mg a half from standard Levitra overdose which is used by all. It is very simple to give the necessary quantity. Don’t switch off the imagination and everything will be good. Perhaps you weren’t surprised.