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

From Wiki

Revision as of 15:58, 8 May 2007 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Background

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.

Method

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.

Reference: http://jailtime.org/howto:filesystem

Personal tools