Backup strategies

Hey, i’m about to change PC’s and i was looking into backup/setup strategies. So far what i’ve got is a script to install all packages i need and all my config files. But it’s a very manual, laborous, error-prone proccess. I was thinking if there is any easier way or any tools i don’t know about that could help with that.
Feel free to recommend technically heavy tools, that wouldn’t be a problem, i just don’t have much of a direction here, any help is welcome. Thanks!

3 Likes

If its just packages and config files, I have my config files in a git repo and that repo also has an install script that installs the config files and whatever packages I need

Yeah that’s my approach so far, but it seems like something that could be easily standardized. Manually doing it, considering in a year or so the installation proccess might change along with the packages, seems redundant.

I mean my ‘manual’ process is git clone <repo> <dir>, cd <dir>, ./install.sh. Not too manual if you ask me

I meant that the install.sh script will naturally have to change and accommodate new default configs over time, and this maintenance cost seems like a common problem that a lot of people have.

I use yadm to manage my dotfiles. It also has a bootstrap script support.

Are you looking for more of a full system backup?

System settings yes, but not really individual files. I found Ansible that seems to be along the lines of what i was looking for but maybe too coorporate, i’ll check it out later today.

Your package manager should be able to export your installed packages, so all you’d have to do is either do a list of installed packages before you switch your OS, or do a monthly export to a file (or more often, depending on the frequency with which you install new programs).

In apt it is as simple as apt list --installed | cut -d '/' -f1 (and you’d just redirect the output to a file). In other package managers, it’s similar:

  • xbps-query -l | cut -d ' ' -f 2
  • pacman -Q | cut -d ' ' -f 1
  • dnf list --installed | cut -d ' ' -f 1

Maybe also replace ‘\n’ with ’ ’ in the output, so you can just run something as easy as an apt-get update && apt-get install -y $(cat package.txt).

In any case, I would rather keep track of what I install and just add them to a list (which I do actually), so that you don’t just install everything, because some package managers manage packages through flags and then basically all your software would be set to “manual installation” and won’t autoremove packages that came as dependencies that aren’t needed anymore.

Also, distros have the different naming conventions for their packages, so if you want to distro-hop, some packages may install, but some may fail, so you need some manual intervention. If you just switch a version or just move to another installation or want to keep the same programs installed on more instances, then this should work.

Personally I’d keep some manual intervention by listing the packages and going through them to remove everything that I know I did not manually install. If they are dependencies, they will be pulled automatically anyway.

As for ansible, it may be worth looking into, because there may be “helper scripts” (for lack of a better term) for each (popular) package manager to install the software, even if they have different naming conventions, so ansible should be able to install the same program on multiple distros even if it has a different name in the repos.


I had to set Arch Linux and Fedora containers to see the output of their package managers’ queries, but holy smoke, Fedora’s image only has 90MB, while Arch’s has 188MB.

1 Like