0

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.

Can Kavaklıoğlu
  • 978
  • 1
  • 8
  • 11
  • 1
    LVM would be much easier - why did you not use it? – Nils Nov 24 '11 at 21:51
  • I did not change the default setup of xen-tools on Debian. Besides I guess I would need to change partition configuration. But host system was already working when I got it. – Can Kavaklıoğlu Nov 25 '11 at 10:44

2 Answers2

1

you first have to resize the "device", then you need to expand the filesystem.

Simple example on how to enlarge an existing file without loosing the content:

echo 123456789 > test.txt
dd if=/dev/zero of=test.txt bs=1 seek=10 count=10
cat test.txt

From your question it is not clear if you use the loop-device as disk, or as partition. In any case I would recommend doing the resize offline (when the disk-device is not attached to the DomU).

Nils
  • 7,695
  • 3
  • 34
  • 73
  • This goes without saying, but it's probably best to export and backup your DomU before doing this (Just In Case). –  Nov 24 '11 at 21:57
0

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

Todd Deshane
  • 463
  • 2
  • 6