0

So I've got this USB stick with a Linux system on it and the plan is the following:

I want to have a backup program on the USB stick that backs up the system to a server. The server has another USB stick (exact same model and size and such) mounted, to which the data is written.

If USB stick A gets lost, I want to be able to just go home and take USB stick B out of the server and start using that, as if nothing happened.

I've got this rsync cmdline:

rsync -avPAHXxz --numeric-ids --exclude='/dev' --exclude='/sys' --exclude='/efi' --exclude='/proc' --exclude='/run' --exclude='/mnt' --exclude='/tmp' --exclude='/home/*/.cache' --exclude='/root/.cache' --delete -e 'sudo -u user ssh' -- / root@server:backups/rootfs

I've got similar a similar one for the /efi directory.

This works great when the plan is to back it up and then later restore it from the server. But I'm wondering if it's still a robust solution when my goal is to have the backup itself be the final usable system.

Bonus question: The UUID's of the partitions on the new system are different, meaning before I can use USB stick B I have to go in and change the UUID's. I'm decently sure that I can manage to do that with a bash script, so that's not an issue. But are there other things like that, which I should be aware of? Some other instance-specific data that needs to be swapped out before the system can work?

1
  • what is the business related question or issue in here?
    – djdomi
    Commented Dec 14, 2023 at 19:56

1 Answer 1

-2

Use archive mode and exclude temporary directories like run, sys, tmp, run, proc etc. You will find lot more thing on this link. Visit: https://wiki.archlinux.org/title/rsync#As_a_backup_utility

And for your bonus question I have very good solution use dd :

backup: dd if=/dev/sda | gzip -9 > backup.img.gz

restore: zcat backup.img.gz | dd of=/dev/sda

But system should not be running at that time otherwise it will have problems. Like you can boot a live distro for this purpose.

3
  • Please don't post link only answers, they become useless when the link dies. Commented Dec 23, 2023 at 6:50
  • 1
    Instead, include the gist of the link in your answer and provide the link for reference. Commented Dec 23, 2023 at 6:51
  • sir, this is archwiki link so not going anywhere. Commented Dec 23, 2023 at 10:39

You must log in to answer this question.