If you have comments or thoughts about my blog, you can contact me at my lab here:
Rescue an ailing VM running out of diskspace.
This is a viable approach - Start by stopping/ shutting down the VM:
Now we need to grow the qcow2 disk. First, change to the folder with your VM images
Next convert you image to raw (Takes a while)
sudo qemu-img convert -f qcow2 /var/lib/libvirt/images/sparcs_wx.img -O raw ~/mydisk.raw
I then expanded the disk to be 20GB (takes a second)
sudo dd if=/dev/zero of=mydisk.raw bs=1M count=0 seek=20480
I then converted it back into a new QCOW disk which is now still only 12gb but can grow to 20 (NOTE: This can take a really long time).
sudo qemu-img convert -f raw mydisk.raw -O qcow2 sparcs_wx_20.img
Finally I rename everything so the VM has the same name on its file.
sudo mv sparcs_wx.img sparcs_wx.img.old
sudo mv sparcs_wx_10.img sparcs_wx.img
I then needed to boot into gparted, delete the extended partition with the swap disk in it, expand the existing partition leaving about 500 mb for a new extended/swap.
If I wanted to me more efficient I would do one more round of conversion from qcow2 to raw and back and that would shrink the img. file down to actual use size.
Recent blog posts
- Easy exporting of Drupal 7 custom fields for use in module code.
- Midnight Commander on OS-X
- Get lists of NIDs from DB filtering by fields without having to do joins - Hello "Entity Field Query"
- Setting the maximum upload size or php memory for Drupal 7
- Charts and Graphs in Drupal 7
- Restore a LVM image to LVM direct from gzip to LVM with a progress bar
- Check if port XXX is listening on your server
- Fix slow SSH response on your Ubuntu Server
- Things i like to do to Ubuntu to make it rock.
- Find and eliminate rogue or ghost KVM Virtual machines under Cloudmin