Can’t grow XFS file system on Amazon EC2

amazon ec2xfs

I added some space to an EBS volume on an Amazon EC2 but tried growing the partition before it had finished optimizing the disk and making all the space available. Now I can see the correct drive size but I'm missing about 1TB of space in the partition I can't grow into.

[root@##### ~]# lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   3T  0 disk
└─xvda1 202:1    0   2T  0 part /
loop0     7:0    0   4G  0 loop /var/tmp

[root@##### ~]# growpart /dev/xvda 1
NOCHANGE: partition 1 is size 4294965248. it cannot be grown

You can see xvda has 3TB available but I can't get xvda1 any bigger. And simply trying to grow the file system doesn't work either.

[root@##### ~]# xfs_growfs -d /
meta-data=/dev/xvda1             isize=512    agcount=1025, agsize=524224 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=536870656, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
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 size unchanged, skipping

EDIT:: I've figured out what's going on here, the AMI set this instance up with an MBR partition which can't grow to more than 2TB. Now I need a way to migrate the data to a new drive with a GPT partition.

Best Answer

Your EBS block device was paritioned with MBR partitioning scheme, which allows partitions to have a maximum size of 2 TB. To have larger partitions you must use GPT partitioning scheme when creating the disk partitions.

If you're booting from the volume, you should consider making a new volume to hold your data instead of extending the size of the boot volume.

Related Topic