1

Sorry if this question is too similar to others, I didn't find anything that helped me.

Following "best practices" I installed my debian with partitions: root, tmp, var and home. Also for the sizes I followed recommendations I read, but after using it for some time it seems for tmp and var I gave too little which gives me problems every now and then.

In order to give more space to var, I decided to symlink /var/cache -> /home/myuser/varcache and then /var/lib -> /home/myuser/varlib. the first seemed to work well, but the second seems to be a bad idea. Actually I see that instead of having /var/lib I have /var/lib/sudo and /var/lib/varlib, which is the actual symlink. Of course some things are not working, so I'm trying to revert it.

Does it make sense that it creates this weird /var/lib/varlib instead of just /var/lib?

Any recommendation on what to do instead?

Would it be a good idea to symlink some folder inside /var/lib instead?

  • Why put those directories under /home/myuser? They don't belong in a user's home directory, ever. create /home/var, /home/var/lib, /home/var/cache instead. BTW mv+symlink is a method with a long history, people have done what you are doing for decades. because it works. – cas Oct 9 '15 at 7:38
  • Good point. It was a very bad idea. Afterwards I did it for specific folders inside var and it went better in terms of just gaining space. After this experience I will create a root partition an another for home, but not partitions for var and tmp because it gave me problems running out of space. – antonio.fornie Oct 14 '15 at 17:48
2

I suspect that it created /var/lib/varlib because you reversed the order of arguments in the ln -s command.

Like almost all unix commands, the order is source followed by destination. ln -s /home/myuser/varlib /var/lib will create a symlink called varlib in /var/lib. ln -s /var/lib /home/myser/varlib will create a symlink called varlib in /home/myuser

Try (as root, in single-user mode so nothing has any files open under /var/lib):

rm -f /var/lib/varlib
mkdir -p /home/var
mv /var/lib /home/var/
ln -s /home/var/lib /var/lib

If you want, you can also move the other symlinked dir out of your home directory (where they really do not belong) and into /home/var:

mv /home/myuser/varcache /home/var/cache
rm -f /var/cache
ln -s /home/var/cache /var/cache
  • It's a good point. But it was not because of the wrong order. Actually I did it for several folder the same way and it's only for that one that I got this problem. – antonio.fornie Oct 14 '15 at 17:47
1

If you use LVM, you can increase /var. If not, what will be the biggest folder in /var/lib? Maybe mysql? If so, you should move mysql dir to your /home/myuser/mysql and make symlink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.