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 /