That's actually quite easy to accomplish on linuxy OS'es. As every device is treated as a 'file' you can therefore create new devices by making a file and connect it to a device driver.
In our case we need to add a disk to a linux guest from OVS. Following are the steps to create the device and present it to the guest.
- create a file in Domain0 for the guest (e.g.: in the running_pool)
dd if=/dev/zero of=disk2.img bs=1M count=(1024*#GB_needed) - change the disk configuration of the guest
edit your vm.cfg and add the disk to the disk parameter.
disk = ['file:/OVS/vm1/running_pool/system.img,hda,w','file:/OVS/vm1/running_pool/disk2.img,hdb,w'] - reboot the guest
xm shutdown guest
xm create guest - logon to guest
ssh hostname - partition the new disk
fdisk /dev/hdb - create the desired filesystem on the partition(s). Example ext3
mkfs -t ext3 /dev/hdb1 - Add filesystem to /etc/fstab for automatic mounting at boot
/dev/hdb1 /u02ext3 defaults 0 0
That's all!
No comments:
Post a Comment