First, you need to install XFS system utilities, which allow you to perform various XFS related administration tasks (e.g., format, expand, repair, setting up quota, change parameters, etc).

Install and using xfsprogs

1
2
3
4
5
6
sudo yum install xfsprogs

ls /dev/sd*

sudo fdisk /dev/sdb
sudo mkfs.xfs -f /dev/sdb1

Now you are ready to mount the formatted partition. Let’s assume that /storage is a local mount point for XFS. Go ahead and mount the partition by running:

1
sudo mount -t xfs /dev/sdb1 /storage

Verify that XFS mount is succesful by running:

1
df -Th /storage

If you want the XFS partition to be mounted at /storage automatically upon boot, add the following line to /etc/fstab.

1
/dev/sdb1  /storage xfs  defaults  0  0

XFS Growth

To see the info of your block device, use xfs_info.

1
2
3
4
5
6
7
8
9
10
$ xfs_info /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=1210880 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=4843520, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

Once the volume group/logical volume has been extended (see this guide for increasing lvm), you can expand the partition using xfs_growfs.

1
2
3
4
5
6
7
8
9
10
11
$  xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=1210880 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=4843520, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
The increase will happen in near-realtime and probably won't take more than a few seconds.

Using just xfs_growfs, the filesystem will be increased to its maximum available size. If you want to only increase for a couple of blocks, use the -D option.