How do you assign cores to LXCs / VMs in proxmox?

bobloadmire

New Member
May 17, 2024
16
2
3
I have an intel rig with big / little core structure. I have some VMs I never want to ping the big core. the core assignment in Proxmox is weird for my pentium 8505. Core 0 (performance) and then core 9-12 (efficiency). is there a way to assign core 9-12 to an lxc via the lxc.conf so that it never puts the process into high power condition? Thanks!
 
Have a look at my script, but you might have to run it manually after VM boot or use a wrapper script to start the VM:

https://github.com/kneutron/ansites...proxmox-vm-assign-cpu-cores-6-vcpu--8-pcpu.sh

You'll need to adapt it for LXC, right now it only expects a VMID number
thanks. I believe this is above my paygrade though. I was hoping just to do a manual edit of the conf file or similar. I don't want to bork my host install, i've already done it once haha
 
- For VMs (QEMU) can be done in the webUI using the setting affinity [1] in VM CPU configuration. Check the box advanced to show that option. Set the core number(s) as output by lscpu.
- For LXC, you can edit the container config file and add something like: lxc.cgroup2.cpuset.cpus: 0,3,5-10, which means "run this LXC in cores 0, 3 and 5 to 10. This requires CGroup2 enabled (which is the default since PVE 7 AFAIR).

[1] https://pve.proxmox.com/wiki/Qemu/KVM_Virtual_Machines#qm_virtual_machines_settings