Grow a GPT / XFS Partition

After expanding a raid the partition and file system will need to be grown to utilize this extra space.  The instructions here are tailored for a GPT partition with an XFS filesystem.  Continue reading for a complete log of the process.

Basic Procedure:

  • Run gdisk on the unmounted drive.
  • Move the secondary partition if aplicable. (x, e, m)
  • Print the partition information and record the starting sector, partition code, partition name, and Partition unique ID. (i, p)
  • Delete the partion and create a new partition using the previous values. Make sure the starting sector is identical. (d, n)
  • Write the partition to the disk and reboot. (w)
  • Grow the file system on the mounted drive with xfs_growfs.


Run gdisk after unmounting the expanded drive.  In my case i’m interested in growing “md1”.

GPT may have installed a secondary header at the end of the previous partition.  The command ‘v’ will check for this condition.  If this is the case moving the header to the end of the drive using the experts menu will allow for the remainder of the space to be used.

Record the data provided from running the ‘p’ and ‘i’ commands.  The starting sector location is particularlyimportant, and could result in data loss it isn’t preserved.


Delete, and then recreate, the partition setting the starting sector to the value that was recorded earlier.

Rename the partition, and set the partition GUID back to it’s previous value.

Reprint the partition information and verify that it matches the original information (excluding the increase in size).

If the data is correct go ahead and write the partition table to the disk.  Agree to the warning with the knowledge that your data could be destroyed if you’ve improperly set any of these values.

At this point you have grown the partition, in order to make use of the extra space the file system will need to be grown too.  XFS works with mounted file systems, so mount or locate your mounted drive and run the xfs_growfs command.

Verify that the extra space is available by running “df -h”.


Leave a Reply

Your email address will not be published. Required fields are marked *