xfs_growfs

Use xfs_growfs to grow an already mounted XFS device.

Initialize specific size

Start off with a size of 1 GB:

mkfs.xfs -d name=/dev/sda,size=1g

Mount the device as normal:

mount /dev/sda /mnt/xfs

Verify everything:

xfs_info /dev/sda
meta-data=/dev/sda               isize=256    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=262144, 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

Grow to a specific size

Double the disk size to 2 GB, using the # blocks as a reference (262144):

xfs_growfs -D 524288 /mnt/xfs
meta-data=/dev/sda               isize=256    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=262144, 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
data blocks changed from 262144 to 524288

Use all available space

With no arguments, xfs_growfs will use all the available remaining space allocated to it.

xfs_growfs /mnt/xfs