2012-03-25

Expanding a Xen image disk

I found various pages on this, but the instructions weren't quite accurate for openSUSE 11.0

1. Stop the guest.
2. Find the image file with 'losetup -a'
3. Make a backup copy.
4. Add (e.g. 4Gbyte) with:  dd if=/dev/zero bs=1024k count=4096 >> /xen/images/yourguest/disk0
5. Mount with: xm block-attach 0 'file:/xen/images/yourguest/disk0' /dev/xvda
6. Using fdisk, find the partition, and resize it.
7. Use resize2fs to increase the filesystem to fill the space, run fsck -f to verify.
8. Unmount with: xm block-detach 0 /dev/xvda
9: Restart the guest.