Tuesday, November 19, 2019

Move or relocate /var to another partition in CentOS 6.8

A few steps to easily move or relocate /var in CentOS 6.8:

Start by sudo bash.

- Mount the future /var with a different name, like /newvar.
  Tip: Setup fstab to use /newvar and use "mount -a" will also help you checking if fstab is fine.
- Copy current /var to new location with rsync:
       rsync -aqxP /var/* /newvar
- fix the security contents with
       restorecon -r -v /newvar
- adapt fstab to mount the new /var (if you had setup fstab to /newvar now is the time to set it to /var)
- reboot