Quantcast
Channel: Active questions tagged mount+fstab - Ask Ubuntu
Viewing all articles
Browse latest Browse all 699

Move directory on restart

$
0
0

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 /var.

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 beforefstabor anything hooks in to var, and I'm not even sure if that's possible?

Any other ideas?


Viewing all articles
Browse latest Browse all 699

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>