Adding a new disk to a Xen VM

      No Comments on Adding a new disk to a Xen VM

Create a new image file (10GiB):

dd if=/dev/zero of=mailstore.img bs=1M count=10k

(Note: You can also create a sparse file with dd’s seek option. Have a look at the dd manpage or the examples on http://en.wikipedia.org/wiki/Dd_(Unix))

Create the new filesystem:

mkfs.ext3 mailstore.img

Label the filesystem:

e2label mailstore.img <new-label>

Edit the DomU’s config file, /etc/xen/<hostname>.cfg and add the new disk:

disk = [ "tap:aio:/vm/disk.img,xvda,w", \
         "tap:aio:/vm/mailstore.img,xvdb,w" ]

Start the VM:

xm create <hostname>.cfg

Edit DomU’s /etc/fstab & mount the disk:

[...]
LABEL=/<new-label>   /<mount-point>   ext3   defaults   0 1
[...]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.