Possible to move /var to separate partition after install?

I just setup a new node, and my idea was to allocate space as I would if I were partitioning a new physical build, however I wasn't aware that I would not be presented with a partitioning wizard (or at least, I wasn't presented with one, or perhaps skipped it? :S).

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

The new install sets you up with default partitions, I believe.

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.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct