Resizing a Xen disk image partition
1 # Stop & backup 2 xm stop sandbox 3 cp -a sandbox/ sandbox.bk 4 5 # Verify MD5 sum 6 md5sum sandbox/disk.img 7 4976347006df34843d29c939b5fc3742 sandbox/disk.img 8 md5sum sandbox.bk/disk.img 9 4976347006df34843d29c939b5fc3742 sandbox.bk/disk.img 10 11 # Create a 5Gb temp file 12 dd if=/dev/zero of=Tempfile bs=1024 count=5000000 13 14 # Append it to the existing image 15 cat Tempfile >> disk.img 16 rm Tempfile 17 18 # Resize the partition 19 resize2fs -f disk.img 20 21 # Check partition & start domU 22 fsck.ext3 disk.img 23 xm create -c sandbox.cfg
Xen DomU maintenance from Dom0
1 xm shutdown xyz 2 mount -o loop disk.img /mnt/os-image/ 3 chroot /mnt/os-image/ 4 5 # Do your stuff 6 7 exit 8 umount /mnt/os-image
Detach from Xen console with Finnish keyboard mapping
Using this key combination on a system having Finnish keyboard mapping you can detach from a xen console.
1 CTRL + Alt Gr + 9
Multiple IP addresses on a Xen VM
Xen VM’s support up to three IP addresses. Just give them as parameters when you create the image. There will be one interface within the Xen and the other IP’s are mapped to interface aliases.
1 xen-create-image ... --ip=10.0.0.44 --ip=10.0.0.45 ...
Fix for "Failed to find an unused loop device" when using xen
If you use Xen and get an error “Failed to find an unused loop device” when you try to create a guest then you are probably using disk images and have run out of loop devices. Each guest uses at least two loop devices. Modify (or create) a file called /etc/modprobe.d/local-loop and add this line:
1 options loop max_loop=64
Use a number suitable for your needs. With 64 loop devices you can run up to 32 guests on your host, assuming you aren’t using loop devices for any other purposes.