Cgroups – How to Unmount Cgroup Version 1

cgroupsmount

How can I remove cgroup version 1 mount points such that I only cgroup version 2 in my /sys/fs/?

Best Answer

One easy way to do it is like this,

mount -t cgroup | cut -f 3 -d ' ' | xargs sudo umount

This will select only the mounts that are part of cgroup version 1, taking just their mount points and then unmounting them.

Update: You may also want to clean up the remaining relics on tmpsfs mount at /sys/fs/cgroup (taken from the answer there),

sudo mount -o remount,rw /sys/fs/cgroup
# Delete the symlinks
sudo find /sys/fs/cgroup -maxdepth 1 -type l -exec rm {} \;
# Delete the empty directories
sudo find /sys/fs/cgroup/ -links 2 -type d -not -path '/sys/fs/cgroup/unified/*' -exec rmdir -v {} \;
sudo mount -o remount,ro /sys/fs/cgroup
Related Question