-2

I want to move /var into /mnt/var since /mnt is mount as a new big partition /dev/xvdb1.

[root@stepping-stone ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  7.1G   12G  38% /
tmpfs           7.8G   16K  7.8G   1% /dev/shm
/dev/xvdb1       99G   23G   71G  25% /mnt

I did that by the following commands:

mv /var/ /mnt/
ln -fs /mnt/var/ /var

Then I found it seems there is standard way to do that: https://serverfault.com/a/703607

I don't see the side effects of my 'easy way'. Anyone who can help point the difference between those two methods? or maybe I missed sth?

LeoShi
  • 97
  • 1

1 Answers1

1

The side effect is that the OS needs to resolve the path to any file under /var twice when you are using a symlink. That is, it first reads from root directory that /var is under /mnt/var. Then it makes the next lookup under /mnt/var directory.

Furthermore, having a system directory under /mnt isn't compatible with Unix standards, and therefore some applications might break, when /mnt does not contain what they expect it to contain.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58