I'm using Ubuntu Server 20.04, and have access to a remote server via SSH.
I need more room in the root FS, and so have made a copy of the
/var directory on another partition. I've then added to my
/etc/fstab to make it mount the new
/dev/sdX2 over the old
All is well...
df -h /var indicates that it's using the newly mounted version.
However, I now can't remove the original one to free up the space that I so badly need. If I run
mount --bind / /mnt/root, and then try to do anything, like
mv /mnt/root/var /mnt/root/var.old, I get:
mv: cannot move 'var' to 'var.old': Device or resource busy.
As this is only really accessible through SSH, I can't get in to single user mode.
So, the only other thing I can think of is to have a script that will move the original
/var directory to
/var.old, and then, once I can see everything is working correctly, remove it once and for all.
The main issue is that this script will need to load before
fstab or anything hooks in to
var, and I'm not even sure if that's possible?
Any other ideas?