Register now and start sharing your code snippets.

Resizing a Xen disk image partition

Shell Script (Bash) posted 12 days ago by christian

   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

Tagged xen, disk, image, resize

Xen DomU maintenance from Dom0

Shell Script (Bash) posted 6 months ago by christian

   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

Tagged xen, domu, dom0, maintenance

Detach from Xen console with Finnish keyboard mapping

Shell Script (Bash) posted 10 months ago by marko

Using this key combination on a system having Finnish keyboard mapping you can detach from a xen console.

   1  CTRL + Alt Gr + 9

Tagged xen, console, detach, suomalainen näppäimistökartta

Multiple IP addresses on a Xen VM

Shell Script (Bash) posted about 1 year ago by marko

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

Tagged xen, multiple ip's

Fix for "Failed to find an unused loop device" when using xen

Shell Script (Bash) posted about 1 year ago by marko

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.

Tagged xen, debian, xen source, loop devices