I wanna use rsync to backup my drive to another drive, I wanna check if I understand a few things correctly

I was reading the arch wiki, this link specifically: https://wiki.archlinux.org/title/rsync#As_a_backup_utility
And I think I understand how to go about this, but I just wanna double check before I make a mess, I’m sorry but I just feel more comfortable so I don’t risk messing up my root drive.
The command I would use to go about this is the following:
rsync -aHAXSx --info=progress2 --delete / /run/media/raccoon/eb860bec-828e-4f73-9c28-6d4b0c21b953/ --exclude={“lost+found”}

Doubts I have: Is that command correct? Should the drive be formatted already or will rsync take care of it? Currently the target drive is ext4, same as the source, but it contains a folder “lost+found” despite being freshly formatted. This won’t copy the other partitions, it won’t make a perfect clone of my drive. Should I manually make other partitions and run rsync for those too? Would it be better to just use a clone utility?

If I understand correctly, this should make a complete copy of my / folder and the next time I run it, it should write only new things and things that were edited, is that correct?

First issue I see, you are doing / which includes /run, I believe that is going to cause you issues. Generally, I see backups of /etc, /var, and maybe /home. Backups though are subjective to your needs.

Your options are aggressive, but not necessarily wrong. Yes, the drive should be formatted, rsync does not format anything. The lost & found directory is normal, and created when you format a drive.

Rysnc will copy the directories, but is not a cloning utility. It will also only update files that are changed on subsequent runs.

As to cloning, that answer is dependent on your desired outcome. If you are expecting to be able to replace a partition with this and run the OS, possibly not going to work. If you want to backup important configs, and return them to the original location with appropriate permissions after a new install this could work in certain situations with a slight modification to your start directory.

Thanks for your post.
As to what I wish to accomplish, in case of my drive failing for whatever reason I would like to have another drive that is the exact copy of my old one so I can just pop it in and continue as if nothing happened.

I kind of got that feeling from your post, you might want to look at this Archwiki

https://wiki.archlinux.org/title/disk_cloning

Thanks haakoth! If it doesn’t take a long time I may do it daily, otherwise a weekly one should do.

1 Like

That is probably not the best solution for you. You might do the clone initially, then work out an rsync solution to restore your changes as your use the system.

Oh? I’m not sure I follow.

Sorry, didn’t mean to confuse the situation. A clone is only giving you a specific time of your machine. If you also rsync some specific folders (as above) you would be current.

Edit: If you are willing to clone weekly that would probably be moot

So you’d suggest I first clone it and then keep it up to date with rsync?
What do you mean it would probably be mute?

It was supposed to be moot.

Anyway, if you would clone weekly, I would not recommend any rsync.

If you only cloned monthly, the yes I would recommend a hybrid solution.

Alright, thanks, and hopefully I won’t need it.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.