I am trying to hot-add a file-based disk to a running KVM virtual server. I've created a new disk from scratch using the command
dd of=/home/cloud/vps_59/test.img bs=1 seek=5G count=0
and I was hoping to get it hot-added to the guest by doing this in the virsh shell:
virsh # attach-disk vps_59 /home/cloud/vps_59/test.img \ vdd --driver=file --subdriver=raw
The XML definition of the domain then becomes:
<disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/home/cloud/vps_59/root.img'/> <target dev='vda' bus='virtio'/> </disk> <disk type='file' device='disk'> <driver name='file' type='raw'/> <source file='/home/cloud/vps_59/test.img'/> <target dev='vdd' bus='virtio'/> </disk>
As you can see, the driver name becomes wrong, it should be
driver name='qemu' as the existing
vda disk. I have tried with
--drive=qemu but it states it is unsupported.
Secondly, I only "see" the newly added drive once I reboot the virtual machine running Ubuntu 10.04.4 LTS. How can I make the drive "hotplug"? I want the virtual machine to "see" the new drive immediately without a reboot.
dd- its arguments come more natural and does the same thing:
qemu-img create test.img 5G