Migrating a Node from cgroup v1 to cgroup v2
CAUTION
Moving your operating system from cgroup v1 to cgroup v2 is outside the
scope of HPE. It is not HPE's responsibility. Please check your operating system
vendor's documentation for the right steps. The steps below are what we followed in our
test lab. Use them only as a reference, and test them in a non-production environment
first.For Red Hat 8.10
- Check current state:
#stat -fc %T /sys/fs/cgroup/ tmpfs-
tmpfs → v1 (legacy/hybrid), needs flipping
- cgroup2fs → already v2, done
-
-
Switch kernel to cgroup v2:
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1 systemd.legacy_systemd_cgroup_controller=0" sudo grubby --info=ALL | grep args -
Reboot:
sudo reboot -
Check current state:
stat -fc %T /sys/fs/cgroup/ cgroup2fs
For suse SP7 and SP5
-
Check current state:
#stat -fc %T /sys/fs/cgroup/ tmpfs-
tmpfs → v1 (legacy/hybrid), needs flipping
-
cgroup2fs → already v2, done
-
- Inspect current GRUB
cmdline:
grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub -
Set the two kernel flags correctly:
- Enable unified hierarchy (cgroup
v2):
sudo sed -i 's/systemd.unified_cgroup_hierarchy=0/systemd.unified_cgroup_hierarchy=1/' /etc/default/grub - Disable legacy controller (set to
0):
sudo sed -i 's/systemd.legacy_systemd_cgroup_controller=1/systemd.legacy_systemd_cgroup_controller=0/' /etc/default/grubNOTEIf either flag doesn't exist yet in the file, you need to append it toGRUB_CMDLINE_LINUX_DEFAULTmanually, instead ofsedreplacing.
- Enable unified hierarchy (cgroup
v2):
-
Check the result. It should show
systemd.unified_cgroup_hierarchy=1 systemd.legacy_systemd_cgroup_controller=0:grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub -
Regenerate GRUB config:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg sudo grub2-mkconfig -o /boot/efi/EFI/sles/grub.cfg -
Reboot:
sudo reboot - After the reboot, check again. It should print cgroup2fs
:
stat -fc %T /sys/fs/cgroup/ cgroup2fs