Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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 Answers 2

up vote 0 down vote accepted

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

share|improve this answer
    
This looks promising I will let you know when I test it. Thanks. –  Can Kavaklıoğlu Nov 25 '11 at 10:51

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).

share|improve this answer
    
This goes without saying, but it's probably best to export and backup your DomU before doing this (Just In Case). –  kce Nov 24 '11 at 21:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.