1

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.

dstana
  • 285
  • 2
  • 10
  • One great thing about AWS is it's trivial to clone a server, create a spot instance, and try things out without affecting your production data. It would be very easy to try the snapshot / new instance idea. This sounds like more of an XFS problem than an AWS problem. – Tim Oct 02 '19 at 07:36
  • Please show the output of the command: `file -s /dev/xvda` – Michael Hampton Oct 02 '19 at 07:47
  • [root@##### ~]# file -s /dev/xvda /dev/xvda: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048, 4294965248 sectors, code offset 0x63 – dstana Oct 02 '19 at 14:15

1 Answers1

2

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • I'm not sure what is useful about this answer, you didn't say anything I didn't already in my question. – dstana Oct 03 '19 at 23:04
  • @dstana It _is_ an answer. That's what is useful about it. There wasn't one before. Answers do not belong in questions anyway. – Michael Hampton Oct 04 '19 at 02:28