3

According to google's documentation:

If you create or resize a root persistent disk or create a disk from an image or a snapshot, your virtual machine instance can automatically resize the partition to recognize the additional space after you restart the instance.

As long as its one of the supported OSes

CentOS 6 & CentOS 7
v20160418 or newer  Yes.
These images will automatically resize root partitions up to 2 TB. Even if 
the disk is larger than 2 TB, the operating system only recognizes up to 2 
TB.

Source Image: centos-7-v20170523

However, /dev/sda1 does not seem to have been re-partitioned to consume the additional space.

[redacted@redacted ~]$ sudo lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0  30G  0 disk
└─sda1   8:1    0  10G  0 part /

[redacted@redacted ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        10G  8.0G  2.0G  81% /
devtmpfs        3.7G     0  3.7G   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           3.7G  8.3M  3.7G   1% /run
tmpfs           3.7G     0  3.7G   0% /sys/fs/cgroup
tmpfs           749M     0  749M   0% /run/user/1000

I have attempted to restart the instance a few times, as well as increase the size(was originally 25 but upped to 30 to try and get it to re-partition)

I've attempted xfs_growfs on the disk, but no luck there

[redacted@redacted ~]# xfs_growfs /dev/sda1 -D 7864320
meta-data=/dev/sda1              isize=256    agcount=4, agsize=655296 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=2621184, 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=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data size 7864320 too large, maximum is 2621184

I'm somewhat stumped as to why this isn't working. The only other option maybe to attach-disk it to another instance and then resize the partition form there, however I'd like to get it working this way, since the above mentioned method would be a lot more work, and is more prone to mistakes.

2
  • I was not able to reproduce this with my test VM which was created with centos-7-v20170523 image. Changing the GCE disk size and rebooting the VM increased the size of the partition for me. Can you check on your VM if disk-expand package is installed and is running when you reboot?
    – Faizan
    Aug 22, 2017 at 18:58
  • @Faizan thanks for pointing me towards disk-expand, the service was disabled for some reason
    – Rulasmur
    Aug 24, 2017 at 7:54

1 Answer 1

1

Thanks to @Faizan.

The expand-root.service was disabled, and simply needed to be enabled

sudo systemctl enable expand-root

1
  • I was killing myself trying to figure out what had changed. This fixed it! Nov 6, 2017 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .