1

This is a little bit tough. In order to reinstall/upgrade a Linux OS, and both keep the /home folder and contents, reformat the target partition, install the new OS, and merge the /home folder and subfolders all together, I need to know the best way to do it.

I've considered that after the install, I first copy the newest /home folder onto the oldest one, then copy the oldest one back over the newer one. That ensures the config files reflect the actual state of the install. But I may be missing something here.

Some suggestions would be appreciated.

3

If you want to merge two directories, keeping the newest of any overlapping files, you can use the --update option to rsync. An invocation like rsync -av --update /old_home/ /home should do it. (Note the trailing slash in /old_home/; this is significant to rsync (it means to copy the directory contents, rather than the top-level directory).)

You can keep the old home directory in various ways. If you're using LVM, it's quick and easy to spin up a new LV for the new install, and keep the old one around to mount. If not, you can use tar to make a backup somewhere else, then extract it to /old_home once you've done the reinstall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.