Debian – Howto resize Xen virtual host disk size on Debian

debiandisk-space-utilizationxen

I am using a loop device disk setup (not lvm) for Xen Debian (squeeze) guest systems on my Debian (squeeze) host system.

I searched for a way of extending guest system disk size. I came accross simple dd commands and nasty mkfs commands.

I wonder if there is a magic xen-tools command set to help me out on Debian systems? Or a simple set of tested dd & mkfs command set for this non-lvm case?

Thanks.

Best Answer

I think it is better and simpler to append space (notice the >> operation) to the disk image

For example, to add 1G to a disk image do:

dd if=/dev/zero bs=1M count=1024 >> ./diskimage.img

or if you want a sparse file

dd if=/dev/zero bs=1 count=0 seek=1G >> diskimage.img

To resize the file system you will then need to use a tool such as

resize2fs <partition>

For a detailed explanation see:

http://grantmcwilliams.com/tech/virtualization/xen-howtos/265-resize-xen-disk-image-used-as-domu-partition