In some situations, it may be necessary to know how to create a Virtual Disk on OVM 2.2 without using OVM Manager, and attach it to a Virtual Machine.
This can be done in OVM 2.2 via the following process:
1. Log into the Oracle VM server where the VM is running.
2. Change the directory at which the repository is mounted, e.g.:
1. Log into the Oracle VM server where the VM is running.
2. Change the directory at which the repository is mounted, e.g.:
# cd /to/path/to/repo
3. Create the raw format .img disk image, e.g. initiating 4 GB Virtual Disk:
# dd if=/dev/zero of=newdisk.img bs=1M count=4096
4. Then add new disk image to disk = [ ] section of vm.cfg file of a Virtual Machine. Format:
disk = [ 'file:/mnt/el4u5_64_hvm//system.img,hda,w' ]
Note: Making any change to vm.cfg file effective requires a domain re-creation which is Virtual Machine shutdown then start (NOT restart.)
5. If an outage on the Virtual Machine is not possible, then hot plug read/write as /dev/xvdX by:
# xm block-attach [domain ID] /path/to/image /dev/xvdX w