You are not logged in.

#1 2015-10-19 17:42:09

lamarpavel
Member
Registered: 2015-10-18
Posts: 48

[SOLVED] Move /var from one disk to another and merge it into / (root)

Hello forum,

I am in the situation where my /var partition is on an old HDD that is to be removed and as a result I need to move /var somewhere else. There is enough room on the SSD that is holding /, so I would like to move my /var there.

So far I have just copied all data from /var (on the old HDD) to a new folder /var_new (on the SSD) via

sudo rsync -aAXv /var/* /var_new

which seems to have worked. (any way to verify that every single file is there?)


The next step would probably be to adjust /etc/fstab, but I'm not sure if it suffices to simply remove the entry for /var in fstab and then rename /var_new to /var. Do I need to rebuild the initramfs? Do I need to change something in the syslinux config? Anything I missed?


Note: I ran the rsync command while the system was online, but the only programs running are a webbrowser and a window manager, do I need to worry about data loss from other processes such as systemd?

Last edited by lamarpavel (2015-10-19 18:50:46)

Offline

#2 2015-10-19 18:03:23

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [SOLVED] Move /var from one disk to another and merge it into / (root)

Should work.  Not sure about open files/implication of doing it from the live system and not from a live cd.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2015-10-19 18:09:04

lamarpavel
Member
Registered: 2015-10-18
Posts: 48

Re: [SOLVED] Move /var from one disk to another and merge it into / (root)

graysky wrote:

Should work.  Not sure about open files/implication of doing it from the live system and not from a live cd.

Alright. I don't feel too good about doing it on a live system either, so I'll just re-do the copying from a chroot before moving on. Thanks.

Last edited by lamarpavel (2015-10-19 18:09:18)

Offline

#4 2015-10-19 18:24:14

marioloko
Member
Registered: 2015-10-18
Posts: 5

Re: [SOLVED] Move /var from one disk to another and merge it into / (root)

You can verify if every single file is there(and has been copied correctly) with the following steps:

move to /var:

cd /var

list all the files in var and its space in a file:

tree --du * > ~/var.txt

move to /var_new

cd /var_new

list all the files in var_new and its space in a file:

tree --du * > ~/var_new.txt

check the difference between files:

diff ~/var.txt ~/var_new.txt

If the command does not print anything then both directories are equals, if not  then print the files that are different.

Offline

#5 2015-10-19 18:42:24

lamarpavel
Member
Registered: 2015-10-18
Posts: 48

Re: [SOLVED] Move /var from one disk to another and merge it into / (root)

Worked without a hitch, thanks for the help graysky and marioloko.

Offline

Board footer

Powered by FluxBB