Best way to transition from VM install to bare metal?

Started by mattlach, July 31, 2024, 08:06:51 PM

Previous topic - Next topic
Hey everyone,

I currently have a OPNSense install inside of a KVM VM on a Proxmox server with virtio forwarded NIC's.

It is currently installed on a UFS partition on a virtual drive (which the Proxmox server has configured as a block device on top of a ZFS pool as a zvol)

Due to WireGuard using WAY more CPU than I ever could have dreamed of in my wildest dreams, I am considering transitioning this OPNSense install to bare metal on this same hardware to squeeze every last bit of performance out of it.   (the other VM's on this host will be transitioned to other hosts)

The plan is to install it to boot off of a ZFS mirror of two drives (so I have some redundancy)

I guess my question is, what is the best way to do this?

If I were to save the config file from the web interface, do a clean install, and then restore the config file, will this capture everything or is there something else or a better way to do this?

Maybe I could back up the old OPNSense virtual drive, install a fresh copy with ZFS, and then copy the contents of the old virtual drive over the contents of the new install (making sure to not overwrite the boot folder, EFI partition or /etc/fstab?

Appreciate any recommendations on best practices to create a  duplicate of this install, just bare metal and booting from ZFS instead of UFS.

OPNSense running as a VM in KVM under Proxmox:
- Rocket Lake Xeon E2314 in a Supermicro X12STL-F.  
- IOMMU forwarded i210 Ethernet for WAN and x520 for LAN.
- Pi-hole running as separate LXC Container on same server. 
- Lots of VLAN's and tricky firewall rules.

Depends. There is no universal documented approach that I know of.
Restore config brings everything that has been configured via the GUI including plugins.
Anything else added or changed via console won't be recorded there so needs to be re-done.
Also remember the interfaces will be different so you need to account for that. Many do a search and replace before importing the config file, i.e. save config, search and replace the interface names in it, import.

Quote from: cookiemonster on August 01, 2024, 03:09:54 PM
Depends. There is no universal documented approach that I know of.
Restore config brings everything that has been configured via the GUI including plugins.
Anything else added or changed via console won't be recorded there so needs to be re-done.

Thank you.

In my case I don't think I have set anything from the console.  At least not that I can remember, so I should be good with this.

Quote from: cookiemonster on August 01, 2024, 03:09:54 PM
Also remember the interfaces will be different so you need to account for that. Many do a search and replace before importing the config file, i.e. save config, search and replace the interface names in it, import.

That is a good point, but again, I think I will be fine here.

I passed through the PCIe NIC's to the VM, so they should show up as the same hardware.

I have one i210 and one x520 NIC in the machine.  The i210 is the WAN interface, and the x520 is the LAN interface.

Of course, these are both dual port, and I only passed through one of the ports of each, but I think I passed through the first one (igb0 and ix0) so I think they will wind up being correct without any changes.   I will just have two extra ports (igb1 and ix1) that will be unused.

Of course, if the order changes, I'll have to swap the cables from one port to the other, but that won't be the end of the world.
OPNSense running as a VM in KVM under Proxmox:
- Rocket Lake Xeon E2314 in a Supermicro X12STL-F.  
- IOMMU forwarded i210 Ethernet for WAN and x520 for LAN.
- Pi-hole running as separate LXC Container on same server. 
- Lots of VLAN's and tricky firewall rules.

Or reset them to your requirements via the console menu post boot.
I'm sure you'll take an image backup beforehand anyway.

Quote from: cookiemonster on August 02, 2024, 09:47:01 AM
I'm sure you'll take an image backup beforehand anyway.

Absolutely.

I always image drives before major changes.
OPNSense running as a VM in KVM under Proxmox:
- Rocket Lake Xeon E2314 in a Supermicro X12STL-F.  
- IOMMU forwarded i210 Ethernet for WAN and x520 for LAN.
- Pi-hole running as separate LXC Container on same server. 
- Lots of VLAN's and tricky firewall rules.