Same VM but with different hardware options?

Thebigluke

Member
Feb 14, 2022
5
0
6
50
Hi folks,

This is a bit of long-winded question, but as it's my 1st ever post on this forum I'll fill you in on my Proxmox status...

I'm one of those n00bs to Proxmox and playing with settings within a Linux environment, though I've been using Linux as a base OS for my work for the past 20 years, I've never had to to much more than cd, mkdir, cp and mv files around!

With the wealth of info online and in the Proxmox documentation as well as this forum, I've learned so much, so thanks!

I currently have dual 1TB nvme mirrored zfs for my vms, and a 6TB mirrored zfs storage pool for Proxmox, and other files on datasets which I share via nfs to my vms, and I've successfully passed through a usb controller for all my devices, and an AMD vega64 gpu, applying the AMD reset patch found online, which works perfectly.

I have Windows 10, Windows 11, Big Sur and Monterey configured as VMs, and obviously I can only passthrough the usb and gpu to 1 host at a time, so depending on which one I'm running through the gpu to dual monitors, the other OS can run in the bg without, splitting the threads and ram equally between them, and I can access it from the main OS I'm running via vnc, MS Remote Desktop or OSX's screen-sharing, the beauty of virtualisation!

Currently I'm removing and re-adding pci devices to each vm depending on which one I want to run on the dual monitors and the other via vnc (so no passthrough).

My question (finally!) is this:

Rather than constantly removing and switching around the pci passthroughs, and changing the graphics output accordingly (none/virtogpu), can I just set up multiple hardware configurations for the same vm/os and launch the one I want to use when needed?

I know I can clone as linked from a template, but can I do a similar thing with a vm, so they use exactly the same HD and EFI HD, just different hardware setups?

I would like to minimise the disk use, so using the same HD would make sense...

Kind of like having 2 PC cases (outside the Proxmox virtual world for this analogy), one with discrete gpu and a load of usb devices, the other just barebones with nothing, and I would just be swapping the hd between them, if that makes sense?

I have tried searching around, but couldn't come up with the correct search terms that found me my answer, so apologies if it's well documented somewhere and I missed it...

Cheers
 
All you can do using the webUI you can also do using the API or CLI. So you could write a bash script to add/remove PCIe/USB devices. Like some kind of menu which lists all shutdown VMs and where you then choose the VM you want your GPU attached to, it will attach it and remove the GPU from all other VMs. That way you could automate it a bit.

Btw...VM configurations are defined in the config files in /etc/pve/qemu-server/YourVMID.conf. To add/remove a GPU you also just could add/remove the line there that defines the PCI passthrough.
 
Hey thanks for the fast response!

Yeah maybe writing a bash script isn't the easiest thing for someone at my level, yet...

But of course! The vms configs are all stored in .conf files!
Could I just duplicate one and version up the vmid, then remove those pci lines form it? Would that sthen how up in Proxmox as a separate vm but using exactly the same hardware and disks, without extra disk use?
 
In theory yes. But PVE uses a naming sceme. If you got a virtual disk "vm-101-disk-0" that means this disk belongs to the VM with the VMID 101 and its the first disk of it. So if you would use the same virtual disk with another VM this could cause problems because the VMID in the disks name isn't matching. I also would be worried not to corrupt the data on that disk. Because that would happen when two VMs share the same disk and you accidentally start the second one while the first one is still running.

So I think the safest way still would be to remove/add the PCI passthrough before starting a VM. Either manually by using the webUI/CLI or by automating it through a script.
 
Last edited:
Fair enough, don't want data corruption!

I guess I can live with those 20 seconds adding and ticking boxes etc...

Thanks for the advice
 
Or just change the config using a script. Shouldn't be too difficult
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!