ESXI 热加载CPU核数

2024-07-16 861 0

手动触发

lscpu | grep "Off-line"
echo 1 > /sys/devices/system/cpu/cpu9/online
OFF_CPUS=$(lscpu | grep "Off-line" | awk '{print $NF}' | tr ',-' ' ')
for i in $(seq $OFF_CPUS);do echo 1 > /sys/devices/system/cpu/cpu$i/online;done

自动触发

# vim /etc/udev/rules.d/99-cpu-hotplug.rules
ACTION=="add", SUBSYSTEM=="cpu", ATTR{online}=="0", ATTR{online}="1"
# 触发 ubuntu 18.04 无效
sudo udevadm control --reload
sudo udevadm trigger --subsystem-match=cpu

解决:
重启虚拟机后 热添加CPU则正常

查看生效

root@ubuntu:~# lscpu
Architecture:         x86_64
CPU op-mode(s):       32-bit, 64-bit
Byte Order:           Little Endian
CPU(s):               4
On-line CPU(s) list:  0-3
Off-line CPU(s) list: 4

相关文章

ESXI不重启热加载新增硬盘空间
ESXI虚拟机磁盘扩容
ESXI 7.0 开启嵌套虚拟化 Centos7 KVM

发布评论