Possible to move /var to separate partition after install?
I would like to have /var on a separate partition but I don't know if it is feasible to try to move the existing filesystems (outlined below) or if I should just redo my partitions.
filesystem mounted on
/dev/xvda / (root)
varrun /var/run
varlock /var/lock
udev /dev
devshm /dev/shm
/dev/xvdc
Confronted with the varrun, varlock filesystems, I am unsure how exactly to proceed. Also, any other directories I would like on separate partitions, is it advisable to fix it, or just to refresh my node with a new install, as I haven't done too much work yet.
Thank you in advance.
R.
2 Replies
Just boot into single-user mode, mount some other partition in /mnt (or wherever), move everything from /var into there, edit your fstab so that partition is mounted as /var, and reboot.
@rlw:
Confronted with the varrun, varlock filesystems, I am unsure how exactly to proceed. Also, any other directories I would like on separate partitions, is it advisable to fix it, or just to refresh my node with a new install, as I haven't done too much work yet.
You could create /var as its own disk image (important for the new backup system).
I personally just boot the profile in single-user mode, login with lish, move /var to /var.tmp, mount the new empty var image right at /var, and then copy everything over with tar.
You don't need to make a fresh install but you might need to resize your current root partition to make room for any additional images, such as /home, /usr or /var/log that you want to isolate.
The varrun and varlock filesystems should automatically mount in your new /var when you reboot. The only "trick" is that you won't be able to delete the old /var until you reboot.