Restoring /home, /usr, /opt, /etc into new installation of same OS version and same Desktop Environment

I have a manjaroKDE system in one computer and am making a plan to migrate it to a new computer. I have lots of customizations in my old system, and would like to avoid the hassle of doing a fresh reinstall of all my apps, then customizing them to be in the same state as the old system, then customizing the desktop environment.

My question is:
If I were to install the same OS version, with same Desktop Environment, in the new computer, and then replaced the contents of its /home, /usr/local, /opt & /etc directories with the contents of the old system, would my programs and settings be useable in the new computer, in the same state they were in?

I would highly suggest that you just reinstall. Copying your home folder is by no means a bad idea, although you should make sure your login name is the same as that of your home folder. As for /etc/, I would just make a note of any important changes you’ve made and perform those after the installation.

/usr, and /opt contain files directly associated with packages and programs compiled from and are generally considered read-only aside from installing/removing software. Therefore, you should probably just make a list of packages you want and install them after the install.

As for /usr/local, copying the directory over shouldn’t create too many problems, especially if it’s just a few bash scripts. But, if you have copied a lot of programs from source, it would probably just be better to do what I said with /usr and /opt and just reinstall anything you’re missing.

You may want to look at transfuse.
I havent had to use it in a while … but also no complaints… project is here:

This will let you get a text file list of what packages you have installed use the following command to see all the packages that were installed explicitly:

pacman -Qe
or if you’d like to send that output to a text file you can easily save and use to refer to later.
pacman -Qe > MyPackageList.txt

That is the method I would use to then manually re-install the packages because personally when I rebuild the system I use that opportunity to not install anything I didn’t use.

However here is a link to a great tutorial on how to fully automate the re-installation.

1 Like
  • avoid restoring AFTER install

you can copy to your new disks before install ( /home/ usr/ /opt ) , but /etc
will be changed by installing

you may also need

  • microcode for boot on cpu
  • changes drivers for video
1 Like

Take a look at disk cloning.
Or rsync.

These are all some great thoughts. I didn’t do it, although I could’ve simply experimented with the new laptop. I just happened to find a yet better solution. I realized that all my goals would be better served by doing a fresh install of manjaroKDE on a 64GB USB stick!

I have spent the last couple days re-doing my old configurations for all my important programs. I can now boot the portable system in both laptops, or any future ones. I plan on using the laptop’s internal drives only for extra storage and backups. This feels like a dream setup so far, no perceivable difference from running system in internal SSD as is the convention.

In any event, this is an interesting topic in its own sake. Here are my thoughts.

@stephane said:

you can copy to your new disks before install ( /home/ usr/ /opt ) , but /etc
will be changed by installing

Which implies /home, /usr and /opt would be left untouched. I was aware modern installers leave /home intact, but didn’t know the same holds true for /usr and /opt. This might be worth trying.

I’ve never dealth with cpu microcodes, but based on quick research, seems like another rabbit hole :slight_smile: like this video, for example: https://www.youtube.com/watch?v=S7lKb5N7M7c

@stargazer I’ve considered disk cloning and rsync. Both require modifying fstab, grub and other components after installing in a new machine, which is daunting to me, as all the tutorials I’ve ever found are directed at linux gurus. Also, having encrypted partitions adds an extra layer of complexity to this procedure.

But now that my main system is in a USB stick, I could very well use clonezilla to easily save disk images as backups. From my understanding, I could even restore one of these images onto another USB stick, and not have to modify the usual things: [fstab, grub, encryptab, network manager], which makes the portable setup the more convenient and easily migratable in case of damage to the USB stick.

@cscs transfuse looks cool I’ll definitely try it at some point.

@cbDejaVu I assume pacman -Qe only saves the package names, but no application configuration data, correct? I know most packages save their configuration files in /home/<user>/.<package_name>/ or in /home/<user>/.config/<package_name>/ . So this leads to a new mystery:
If I reinstalled the packages from a packagelist.txt, and copied the old /home to the new system, would this be ALL that is necessary to have the packages be configured just as before? Or would there be missing bits and pieces from other locations?? (such as… maybe /opt, or /usr/local)???

Correct those instructions give you just a text file that lists all your packages that are explicitly installed so that you can reinstall the same packages again. It would be a “new” installation of those packages so any configurations you’d either have to backup before hand or recreate.