tech_documents:linux:grow_xfs_filesystem_partition

https://ubuntuforums.org/showthread.php?t=1445819

Growing an XFS partition with parted This is a lack of familiarity on my part and I couldn't find this clearly documented anywhere. So, hopefully this will help the next person googling in the middle of the night like me. Moderators if this is in the wrong place, please move this!

I have a software RAID5 with XFS as the filesystem and have just added two more disks to the array and done all the mdadm functions to add them to the array - google that, it's pretty easy to find.

XFS has the xfs_growfs that you can grow the file system, but you have to resize the underlying partition first, else the output of xfs_growfs simply prints the size information about the partition as it exists. No hints whatsoever as to why the filesystem hasn't grown.

parted has the ability to grow a partition - google that and you will quickly find parted doesn't support XFS. You can't resize an XFS partition.

What you can do is simply delete the existing partition and create a new one. This is the bit of information that is a bit hard to come by.

example:

parted /dev/md0
print
Model: Unknown (unknown)
Disk /dev/md0: 6001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 3001GB 3001GB xfs primary

rm 1

mkpart (choose primary, xfs, then 1MB for start (1MB is most common but you should match the Start listed above) and size of disk, which is in this case md0 and 6001GB)

print 
Model: Unknown (unknown)
Disk /dev/md0: 6001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 6001GB 6001GB xfs primary


mount the partition - xfs_growfs works on mounted partitions.

mount /dev/md0p1 /media/md0p1

xfs_growfs /media/md0p1

Once you have the steps, it's amazingly fast - I just spent a long time looking for the confirmation that deleting and redefining the partition wouldn't lose data.

  • tech_documents/linux/grow_xfs_filesystem_partition.txt
  • Last modified: 2022/01/12 05:42
  • by jacob.hydeman