<div dir="ltr"><div><div><div>Hi stackers,<br><br></div>I have come across this problem of growpart/resizefs not working with CentOS 6.5 Cloud image on first boot.<br><br></div>Here is the relevant config in cloud.cfg<br>==============================<br>
<br>growpart:<br> mode: auto<br> devices: ["/"]<br>resize_rootfs: True<br>resize_rootfs_tmp: /dev<br><br>cloud_init_modules:<br> - bootcmd<br> - write-files<br> - growpart<br> - resizefs<br><br></div>Here is the relevant log on first boot:<br>
============================<br>[CLOUDINIT] helpers.py[DEBUG]: Running config-growpart using lock (<cloudinit.helpers.DummyLock object at 0x1ed06d0>)<br>[CLOUDINIT] util.py[DEBUG]: Running command ['growpart', '--help'] with allowed return codes [0] (shell=False, capture=True)<br>
[CLOUDINIT] util.py[DEBUG]: Reading from /proc/1108/mountinfo (quiet=False)<br>[CLOUDINIT] util.py[DEBUG]: Read 521 bytes from /proc/1108/mountinfo<br>[CLOUDINIT] util.py[DEBUG]: Reading from /sys/class/block/vda1/partition (quiet=False)<br>
[CLOUDINIT] util.py[DEBUG]: Read 2 bytes from /sys/class/block/vda1/partition<br>[CLOUDINIT] util.py[DEBUG]: Reading from /sys/devices/pci0000:00/0000:00:05.0/virtio2/block/vda/dev (quiet=False)<br>[CLOUDINIT] util.py[DEBUG]: Read 6 bytes from /sys/devices/pci0000:00/0000:00:05.0/virtio2/block/vda/dev<br>
[CLOUDINIT] util.py[DEBUG]: Running command ['growpart', '--dry-run', '/dev/vda', '1'] with allowed return codes [0] (shell=False, capture=True)<br>[CLOUDINIT] util.py[DEBUG]: Running command ['growpart', '/dev/vda', '1'] with allowed return codes [0] (shell=False, capture=True)<br>
[CLOUDINIT] util.py[DEBUG]: resize_devices took 0.076 seconds<br>[CLOUDINIT] cc_growpart.py[DEBUG]: '/' NOCHANGE: no change necessary (/dev/vda, 1)<br>[CLOUDINIT] helpers.py[DEBUG]: Running config-resizefs using lock (<cloudinit.helpers.DummyLock object at 0x1ed08d0>)<br>
[CLOUDINIT] util.py[DEBUG]: Reading from /proc/1108/mountinfo (quiet=False)<br>[CLOUDINIT] util.py[DEBUG]: Read 521 bytes from /proc/1108/mountinfo<br>[CLOUDINIT] cc_resizefs.py[DEBUG]: resize_info: dev=/dev/vda1 mnt_point=/ path=/<br>
[CLOUDINIT] cc_resizefs.py[DEBUG]: Resizing / (ext4) using resize2fs /dev/vda1<br>[CLOUDINIT] util.py[DEBUG]: Running command ('resize2fs', '/dev/vda1') with allowed return codes [0] (shell=False, capture=True)<br>
[CLOUDINIT] util.py[DEBUG]: Resizing took 0.004 seconds<br><br><div>In the base image, I have upgraded cloud-init to 0.7.4-1.el6, and installed cloud-utils, cloud-initramfs-tools. After the first *reboot*, growpart/resizefs does their job and the root file system is grown to disk size.<br>
<br></div><div>After a reboot, the relevant cloud-init logs:<br>===================================<br>cc_growpart.py[DEBUG]: '/' NOCHANGE: no change necessary (/dev/vda, 1)<br>util.py[DEBUG]: Resizing took 13.776 seconds<br>
cc_resizefs.py[DEBUG]: Resized root filesystem (type=ext4, val=True)<br><br></div><div>I wish the growpart/resizefs happen on first boot, what can I do?<br></div><div><br clear="all"></div><div><div><div><div><br>-- <br><div dir="ltr">
<div><span><span> </span><i>YY Inc. is hiring</i> openstack and python developers. Interested? Check <a href="http://soa.game.yy.com/jobs.html" target="_blank">http://soa.game.yy.com/jobs.html</a><br><br></span>--<br>Thanks,<br>
</div>Yuanle<br></div>
</div></div></div></div></div>