Looking for a fast and safe mode to increase the size of a Xen VM I find this link that match exactly my situation: a image disk with only two partitions, the root partition and a swap partition.
So this is the steps that I followed to reach my goal:
- create a backup of the diskimage that you want to modify
- shutdown domU
- add extra space to the image by entering: dd if=/dev/zero bs=1M count=1024 >> /path/to/diskimage (this would add another 1024M to the DomU image)
- boot domU
- disable swap partitions by entering: swapoff /dev/xvda2 (or what corresponds to your setup)
- fdisk /dev/xvda (or what corresponds to your setup)
- press p + enter so see the whole disksetup
- delete the second swap partition by entering d + enter and then 2 + enter
- delete the system partion by entering d + enter and then 1+enter
- recreate the system partition with the same start cylinder than the older one but an end-cylinder bigger than the old cylinder value. press n <enter> p <enter> 1 <enter> and then enter the values
- recreate the swap partition (with n <enter> p <enter> 2 <enter> and appropriate values
- chance the partition type of partition 2 to swap by pressing: t <enter> 2 <enter> 82 <enter>
- exit fdisk by pressing w <enter>
- execute: mkswap /dev/xvda2 to make the swap space ready
- reboot domU
- execute: resize2fs /dev/xvda1
Be aware that if you have a different partition schema this would not work!
Tags: xen