The CageFS skeleton can take quite a lot of space; that's why some users prefer moving it somewhere else. In the following example, we'll move it to /home/cagefs-skeleton.
First of all, disable CageFS entirely via:
cagefsctl --disable-cagefs cagefsctl --unmount-all
Verify that the following command gives the empty output:
cat /proc/mounts | grep cagefs-skeleton
Verify that the directory cagefs-skeleton.bak does not exist (if it does exist - change name "cagefs-skeleton.bak" to something else):
ls -d /usr/share/cagefs-skeleton.bak mv /usr/share/cagefs-skeleton /usr/share/cagefs-skeleton.bak mkdir -m 0755 /home/cagefs-skeleton ln -s /home/cagefs-skeleton /usr/share/cagefs-skeleton cagefsctl --init cagefsctl --enable-cagefs cagefsctl --remount-all
Verify that the following command gives the empty output:
cat /proc/mounts | grep cagefs-skeleton.bak
Now you can safely remove cagefs-skeleton.bak directory:
rm -rf /usr/share/cagefs-skeleton.bak
Note for cPanel users
If you are placing skeleton in /home directory on cPanel servers, you must configure the following option in cPanel WHM:
WHM -> Server Configuration -> Basic cPanel/WHM Setup -> Basic Config -> Additional home directories Change the value to blank (not default "Home"). Hit Enter.
Without changing this option, cPanel will create new accounts in incorrect places.
A common "Device or resource busy" error
Sometimes after disabling CageFS, some of the mounts may still be mounted. In that case, you'll see the output similar to the one below:
mv /usr/share/cagefs-skeleton /usr/share/cagefs-skeleton.bak
mv: cannot move ‘/usr/share/cagefs-skeleton’ to ‘/usr/share/cagefs-skeleton.bak’: Device or resource busy
In this case, check what's left mounted via:
grep cagefs-skeleton /proc/mounts
And if the output contains some existing mounts like:
/dev/sda2 /home/cagefs-skeleton/opt/cpanel/ea-php72/root/usr/bin ext4 ro,nosuid,relatime,errors=remount-
You may unmount them with the umount command:
umount /home/cagefs-skeleton/opt/cpanel/ea-php72/root/usr/bin
All done! Try moving the skeleton again.
If the issue still occurs, you may check the processes still using old mount points with this command:
grep -rl cagefs-skeleton /proc/*/mounts | cut -d"/" -f3
In the output, you will receive the ID of the processes that still use the CageFS skeleton. You may check them via the ps command:
ps u 8917 9
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9 0.0 0.0 0 0 ? S Aug08 18:12 [rcu_sched]
root 8917 0.2 0.6 1385176 12252 ? Ssl Sep03 17:01 /usr/lib/Acronis/BackupAndRecovery/mms
It may not be safe to kill the processes right away. But if you are sure that it's nothing important, kill them and try moving the CageFS skeleton again:
kill -9 8917 9
Comments
0 comments
Please sign in to leave a comment.