Hot add PCI devices, how to keep them after reboot?

  • Thread starter Thread starter Simba
  • Start date Start date
S

Simba

Guest
Hi Guys,

I'm adding raw drives to my KVM by using the QM Monitor, but I loose them after reboot.
Any idea how I can make this persistent?

This is what I am now doing after every reboot:

Code:
pci_add auto storage file=/mnt/data1/images/drive0.raw,if=scsi,id=scsi0-hd0
pci_add auto storage file=/mnt/data1/images/drive1.raw,if=scsi,id=scsi0-hd1

Thanks!!
 
Why don't you simply add them on the web interface? Select your VM, then on the hardware tab, Add -> Hard Disk... Simple enough.
 
Yes, but that doesn't work for existing drives unfortunatly.

I have a number of RAW containers which I'm connecting in this way, I'd expect you'd be able to add them through the KVM configuration file perhaps, but can't find the correct syntax for it..
 
You can add the same raw files as devices on the web interface, with the same parameters to survive a reboot/restart. Although in your case, you need to add the directory containing your raw files as directory storage first. Probably you also need to rename your files according to the PVE standard. Or alternatively, you can add them to /etc/pve/nodes/nodename/qemu-server/VMID.conf. As for the syntax - just add a new scsi device, observe the syntax in the modified config file and apply it accordingly for your own files. You can delete the newly created device afterwards. Tho I'd recommend the web interface for all operations, it's less hassle and smaller chance of potential misconfiguration.