Is it safe to move complete /var directory in separate partition and create symlink to it?
mv /var /mnt/storage
ln -s /mnt/storage /var
Distribution is Google Cloud CentOS Image
I do not want to use bind mount due the following reasons:
Is it safe to move complete /var directory in separate partition and create symlink to it?
mv /var /mnt/storage
ln -s /mnt/storage /var
Distribution is Google Cloud CentOS Image
I do not want to use bind mount due the following reasons:
I don't know any reason that this shouldn't work. Symlinks are a standard feature of Linux filesystems, that are recognized and used correctly by every utility I know of.
I've never symlinked all of /var, but I've done large parts of it. It worked fine. Just make sure the permissions are set correctly on /mnt/storage.
Just tried it on ubuntu 20.04 and it worked fine. I did the copying and the symlink from rescue mode root shell.
And to clarify why it might be helpful - when you don't have unpartitioned disk space, and you need to move /var to a simple folder on another disk without re-partitioning anything. Yes, you can use a bind mount, but it can be rather inconvenient to figure out later what is mounted where, so I prefer ln -s
UPDATE: Ok, I've found at least one problem - snap stopped working correctly, seems like AppArmor issue. I gave up for now as I've found an unused partition right after ex-var, so I've put it back and enlarged it with resizefs.