2

I just installed Debian 8.2 Jessie fresh on a new machine. I ran tar -zxvpf myBackup.tar.gz to extract folders from a backup from my old machine, which also ran Debian 8.2 Jessie.

The folders I extracted are etc, home, root, usr and var. What files from each do I copy over to my new install?

6

You can restore your home directory, or all home directories (i.e. all of /home), /usr/local, and /root wholesale and indiscriminately. For the rest:

  • /usr: don't restore this at all (except for /usr/local). The contents are all managed by the Debian package manager. Just get the files back by reinstalling the same packages you had before. In fact, unless you've made unusual modifications to your system such as using dpkg-dirvert to replace things in /usr, you may not veen need to keep a backup of /usr at all (but do keep /usr/local).
  • /etc: Unpack your backup to a staging location and cherry pick individual changes to restore. You can compare the old and new version with something like diff -ru but you will notice many differences that you should ignore, such as system users with different uids, and different config files due to packages that were installed before but not anymore or the opposite. Only restore changes you recognize as changes you made yourself.
  • /var: A lot like /etc but a little easier. You can get rid of large parts of /var from the backup such as /var/cache and maybe /var/log (if you don't care about old logs), and replace other parts such as /var/www completely from the backup. Still others such as /var/lib you can keep around so you can refer to the state of the old system but don't use the contents on the new system.

In short, knowing what you can replace and not replace requires a lot of knowledge about what the parts are, and no concise general advice will do. You can try to restore files ambitiously if you want to save time, but you should know that it's risky. The safest option is really to cherry pick exactly what you need from the backup.


Of course your other option is to restore everything faithfully from the backup instead of reinstalling. Then you'll get back a system that is exactly the same as the old system with the least amount of work.

|improve this answer|||||

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.