CentOS resize

For most operating systems the resizing of the partition is done automatically however for CentOS 6 this can be tricky as the kernel is <3.8 this leading to cloud-init not to initalise. It causes issues with the partition on boot and subsequently the partition isn't resized. Even with the conventional method of vps resizing, it doesn’t complete the task on boot at the very end.

To perform the reboot we need to invoke dracut. This will allow us to resize the CentOS due to it overwriting the initramfs file.

Dracut

Creates an initial image used by the kernel for preloading the block device modules (such as IDE, SCSI or RAID) which are needed to access the root filesystem.

For us to perform this action we can run the following commands:

yum update -y
yum install -y epel-release
yum install -y cloud-init dracut-modules-growroot
rpm -qa kernel | sed 's/^kernel-//'  | xargs -I {} dracut -f /boot/initramfs-{}.img {}