CentOS 6 - Troubleshoot root disk not resized
Problem:
Centos 6 Generic Cloud Image doesn't resize root partition accordingly
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
`-sda1 8:1 0 8G 0 part /
Solution:
Install all available updates
sudo yum update -y
Install the EPEL helper package
sudo yum install -y epel-release
Install cloud-init and dracut-modules-growroot
This has to be done after installing epel-release, because otherwise YUM won't look in the EPEL repository, where dracut-modules-growroot is available.
sudo yum install -y cloud-init dracut-modules-growroot
Switch to root
sudo su
Rebuild all initramfs images.
This is very important. Without rebuilding the initramfs images, the module won't be available and nothing will get done.
rpm -qa kernel | sed 's/^kernel-//' | xargs -I {} dracut -f /boot/initramfs-{}.img {}
Reboot the VM
reboot
Check the partition
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
`-sda1 8:1 0 20G 0 part /