Resize/Increase the Size of a File Based DomU Xen Filesystem

From Wiki

Jump to: navigation, search


File based Images are sometimes used as a quick method to getting a DomU guest Xen up and running. LVM is the production method allowing for simple resizing. File based Images however, can be increased in size.


Backup the File based image firstly, making sure it is not mounted nor running as a xen domU.

dd if=/dev/zero of=file.img bs=1M conv=notrunc count=1 seek=2000
#This resizes the file.img to 2GB.
losetup /dev/loop1 file.img
#loop1 had to be used as xen was already running a different domU via loop0.
e2fsck -f /dev/loop1
resize2fs /dev/loop1
e2fsck -f /dev/loop1
losetup -d /dev/loop1

That should be it all ok. It is a very fast method. It would be possible to simply mount the old image, and mount a newly created larger image and to copy across everything manually, however the above should work fine.


Personal tools