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.
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.
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