openstack and resizing qcow-based instances
February 21, 2013
So – the trick with resizing a qcow based instances is this:
1. either you have to resize the partitions in the initramfs of the instance (which is not yet available as something we can easily do, but we’re working on it :)
2. you have to resize the partition on the live instance and then reboot the instance.
Since 1 is going to take more time/testing – I went ahead to make 2 as painless as possible.
using the cloud-utils and ansible I came up with this:
Put in the hosts you want to run it against. It installs cloud-utils, resizes the partitions using growpart, reboots, waits for the instance to come back alive, then does the fs resizing.
I timed it – it took a total of 1m2s and that includes installing cloud-utils, waiting at minimum 10s for the instance to reboot and then resizing the actual fs.
The example I gave checks the values from growpart – so it won’t run more than once (and it won’t run if you cannot resize). So you can run this play over and over and not reboot it all the time. I’m thinking I’ll probably include this as a tasklist for a quick instance provisioning playbook.