Adding a New Disk to a Xen VM
From Granizada
--Brett 02:00, 28 December 2006 (CST)
Create a sparse file. Seek indicates the "size" of the disk in MB. 10000 = 9.8GB
# dd if=/dev/zero of=mailstore.img bs=1M seek=10000 count=1
Create the filesystem. Here we're specifying that the filesystem be created with indexing and journaling turned on.
# mke2fs -j -O dir_index mailstore.img
Edit the DomU's config file, /etc/xen/domains/<hostname>.cfg and add the new disk:
disk = [ 'file:/home/xen/domains/lucius/disk.img,hda1,w', \
'file:/home/xen/domains/lucius/swap.img,hda2,w', \
'file:/home/xen/domains/lucius/mailstore.img,hdb1,w' ]
Start the VM:
xm create <hostname>.cfg
Add to the DomU's /etc/fstab & mount the disk as normal.