Operations 11 min read

How to Create, Quota, and Expand an XFS Filesystem on RHEL/CentOS 7

This guide walks through creating an XFS filesystem on a new partition, configuring LVM physical, volume, and logical volumes, formatting with XFS, enabling user and group quotas, assigning quota limits, testing quota enforcement, and finally expanding the logical volume and growing the XFS filesystem.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Create, Quota, and Expand an XFS Filesystem on RHEL/CentOS 7

XFS is a high‑performance, scalable filesystem and the default on RHEL 7/CentOS 7, offering metadata journaling, online defragmentation, and resizing.

Below are the step‑by‑step commands to create an XFS filesystem, set up LVM, enable quotas, and expand the filesystem.

1. Partition a 2 GB disk and enable LVM

[root@localhost ~]# partprobe /dev/sdb
[root@localhost ~]# parted /dev/sdb mklabel gpt
[root@localhost ~]# parted /dev/sdb mkpart primary 4MiB 2048MiB
[root@localhost ~]# parted /dev/sdb set 1 lvm on

2. Create a Physical Volume (PV)

[root@localhost ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created

3. Create a Volume Group (VG) named xfsgroup00

[root@localhost ~]# vgcreate xfsgroup00 /dev/sdb1
Volume group "xfsgroup00" successfully created

4. Create a Logical Volume (LV) xfsdata of 1 GiB

[root@localhost ~]# lvcreate -L 1G -n xfsdata xfsgroup00
Logical volume "xfsdata" created

5. Format the LV with XFS

[root@localhost ~]# mkfs.xfs /dev/xfsgroup00/xfsdata

Note: XFS cannot be shrunk after creation; use xfs_growfs to enlarge.

6. Mount the filesystem with quota options

[root@localhost ~]# mkdir /xfsdata
[root@localhost ~]# mount -o uquota,gquota /dev/xfsgroup00/xfsdata /xfsdata
[root@localhost ~]# chmod 777 /xfsdata

7. Configure and verify quotas

# xfs_quota -x -c 'report' /xfsdata
# xfs_quota -x -c 'limit bsoft=100M bhard=120M zhongq' /xfsdata
# xfs_quota -x -c 'report' /xfsdata

Assign a soft limit of 100 MiB and a hard limit of 120 MiB to user zhongq.

8. Test quota enforcement

# su zhongq
$ dd if=/dev/zero of=/xfsdata/file1 bs=1M count=100
100+0 records in
100+0 records out
$ dd if=/dev/zero of=/xfsdata/file2 bs=1M count=100
dd: error writing ‘/xfsdata/file2’: Disk quota exceeded

9. Expand the LV to 1.5 GiB and grow the XFS filesystem

[root@localhost ~]# lvextend -L 1.5G /dev/xfsgroup00/xfsdata
Logical volume "xfsdata" successfully resized
[root@localhost ~]# xfs_growfs /dev/xfsgroup00/xfsdata -D 393216
data blocks changed from 262144 to 393216

After expansion, the filesystem shows the new size:

# df -h | grep xfsdata
/dev/mapper/xfsgroup00-xfsdata  1.5G  153M  1.4G  10% /xfsdata

These steps demonstrate full lifecycle management of an XFS filesystem with LVM, quota configuration, and dynamic resizing.

XFS quota example
XFS quota example
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

quotaFilesystemXFS
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.