Configure XFS Filesystem with Quotas on Fedora
By Luca Berton · Published 2024-01-01 · Category: installation
Step-by-step guide to mounting XFS filesystems with user and group quotas on Fedora using fstab and systemd mount units.

Managing storage is a critical aspect of system administration, and the XFS filesystem is a popular choice due to its performance and scalability. This guide explains how to configure an XFS filesystem with quotas on Fedora, using both /etc/fstab and systemd mount units.
Introduction
This article walks you through the steps to:
• Configure an XFS filesystem on a secondary disk.
• Enable user (uquota) and group (gquota) quotas.
• Manage mounts using /etc/fstab or systemd units.
Let’s dive into the configuration.
See also: Ansible Delete File: Remove Files & Directories (state=absent Guide)
Prerequisites
• A secondary disk (e.g.,/dev/nvme0n2p1) is attached to your system.
• Familiarity with basic Linux commands.
Configure the XFS Filesystem
1. Identify the Disk
Use lsblk to identify the disk and its partition:
lsblk
Ensure the disk (e.g., /dev/nvme0n2p1) is recognized.
2. Format the Partition
If the disk is not formatted, initialize it with the XFS filesystem:
sudo mkfs.xfs /dev/nvme0n2p1
3. Create a Mount Point
Create a directory where the filesystem will be mounted:
sudo mkdir /mnt/data
See also: ansible.builtin.find Module: Search Files by Pattern, Size & Age (Guide)
Enable Quotas in /etc/fstab
To enable quotas during boot, edit /etc/fstab:
sudo nano /etc/fstab
Add an entry for the partition:
UUID=27acffe0-c3d5-43b7-8614-baa5d9ffce60 /mnt/data xfs uquota,gquota 0 0
Find the partition’s UUID using:
blkid
Remount and Verify
Remount all filesystems:
sudo mount -a
Verify the mount options:
mount | grep /mnt/data
Use Systemd Mount Units for Advanced Configuration
Create the Systemd Unit
Create a custom systemd unit file:
sudo nano /etc/systemd/system/mnt-data.mount
Add the following configuration:
[Unit]
Description=Mount XFS filesystem with quotas on /mnt/data
After=local-fs.target
[Mount]
What=/dev/nvme0n2p1
Where=/mnt/data
Type=xfs
Options=defaults,uquota,gquota
[Install]
WantedBy=multi-user.target
Enable and Start the Unit
Reload systemd and enable the unit:
sudo systemctl daemon-reload
sudo systemctl enable mnt-data.mount
sudo systemctl start mnt-data.mount
Verify the status:
sudo systemctl status mnt-data.mount
Check the Mount
Ensure the filesystem is mounted with quotas:
mount | grep /mnt/data
See also: Ansible Search String in File: lineinfile & regex Guide
Initialize Quotas
Enable quotas on the XFS filesystem:
sudo xfs_quota -x -c "quota" /mnt/data
Check quota status:
sudo xfs_quota -x -c "report" /mnt/data
Optional: Set User and Group Quotas
To set quotas for a user:
sudo xfs_quota -x -c "limit bsoft=500m bhard=600m username" /mnt/data
View quota usage:
sudo xfs_quota -x -c "report -h" /mnt/data
Verify Persistence
Reboot the system to confirm the configuration:
sudo reboot
After reboot, verify the mount and quotas:
mount | grep /mnt/data
sudo xfs_quota -x -c "report" /mnt/data
Conclusion
You have successfully configured an XFS filesystem with quotas on Fedora. Whether you use /etc/fstab or systemd, this guide ensures your filesystem is ready to enforce storage limits for users and groups.
--- If you found this guide helpful, consider supporting the community or sharing your success story!
References
• Learn More About XFS Filesystem • Systemd DocumentationRelated Articles
• How to install Ansible in Fedora 34 - Ansible install • How to install Ansible in Fedora 35 - Ansible install • How to install Ansible in Fedora 36 - Ansible installCategory: installation