Backup Strategy Questions

I’m new to Linux backups, moving from Windows finally. I’ve used Linux plenty throughout the years, but never used in a way that required backing anything up from the Linux system itself. From all the research done, I have a decent understanding I think on how I would restore and how things are different from Windows, but I would like to mention my strategy and situation and have someone comment on what I have come up with in case there is a better way or I’m missing something.

I am going to do EOS with KDE Plasma on BTRFS, stock partitioning. I have an unRAID server that I will be backing up to locally over the network. File System on the drive I’ll be backing up to in that server is XFS.

I will do an image backup using (Rescue)Clonezilla as often as I feel like it. I have to take it offline using and boot into the backup software to do it, so it’s not convenient or automated. How the following works will help to determine how often I would run this manual offline image backup.

Preparing for the worst case scenario, I will always have an image backup that is at least somewhat recent, as well as whatever other backups done (likely) daily I’d imagine to the server. These backups in turn get uploaded to the cloud, but I’m not asking about that part.

What I want to know is that if I had a drive failure or system was so borked out that I had to go with a backup(s) from the server is how I would get myself back to the most recent backup, which is likely not the image since I would only do so often, so in this case I see myself having to start with the image restoration, then needing to restore from the daily backups to get the system fully up to date.

Now I know my home folder will have at least almost everything I would need to store to get files and configs back. I also know how to keep an up to date package list and how to reinstall those apps from it (if need be). What I don’t quite know is whether there is any other data from outside of my home directory that has something worth restoring from a daily backup that has changed since the last image. If so, what and how would I restore? Perhaps it’s the same as home, just copying files back over, which I would do from Live OS environment to be safe. Please let me know your thoughts, thanks.

If you keep all your data in /home or whatever you are backing up, you should be able to restore the image, update your system and then copy the data over.

Be aware that updates get more complicated the older they are so if you don’t take an image for a long time, it might need a bit of help.

2 Likes

Regarding data outside of /home, is that still applicable to it? I don’t know what all I may or may not need from outside of /home. That’s the part I am trying figure out.

I find it helpful to keep a list of things I configure anywhere outside of /home so I can replicate them in case of a straight up clean reinstall, and I also save the files where it makes sense. Examples:

I need changes in my /etc/environment file. I make a note of that, what it is, and also copy the file to a directory containing this and other such files in within my /home.

I need settings in my /etc/X11/xorg.conf.d/10-monitor.conf file. Same thing, copy the file to home and also keep notes about the change.

Crontab as well

And so on and so forth. Naturally, if you are using a backup image none of this is necessary, but when doing it a clean install it can save HOURS of time and headache (how did I fix that issue again?). It’s well worth the few extra minutes.

1 Like

I just use borgmatic for a daily backup. In my setup only thing that is worth backing up is /home, /etc for system configs and /usr/share/backgrounds for all those wallpapers I collected over the years that I do not want to loose. Everything else is just default stuff that gets installed with some packages.

The backup restoration is very simple - /home can be just replaced on fresh install. For /etc I first mount latest borg backup to a directory an then use tool like meld or kdiff3 to manualy go over every difference. In theory it could be just replaced completely but there is stuff like passwd or group that could break the system.

That said, for me this is a contingency plan. I do not plan to often restore any backup. Last year I did it only once when my /bin and /boot directories were damaged during an interrupted update.

2 Likes

The problem is that you are the only one who can know. Only you know where you keep your data.

From a general perspective, the only real other thing I can think of would be config files in /etc but you probably don’t change those very often so if you have a reasonably recent image of the disk that should be “close enough”

1 Like

Thanks for the assistance. I don’t know as of now what data outside of /home I would need, but I want to play it safe and backup anything I could potentially use. What if I just backed up the entire / directory and restored it? Would that work? Seems overkill, but is that actually doable?

It is possible but it requires extreme care to do it right. You need to make sure your backup commands preserve permissions and attributes exactly and that you don’t backup or restore things you shouldn’t.

The arch wiki recommends this command:

rsync -aAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / */path/to/backup*
1 Like

Plus, backup excludes some directories: .snapshots/*, /var/cache/*, /var/log/*, /home/**/.cache/*, /root/.cache/*, (/btrfs/*)

1 Like

First of all, I have read that it is not recommended to enable @home in TimeShift. (I could not figure out why), but after several edits, snapshots, reboots… everything is working at my side as expected.
Maybe my system is configured/installed in a way that is ok with that.
OP configuration is a bit different.
But I thought this might at least help him work something out.

Same here.

I am not an expert (only 1 month on EOS and 8 days on BTRFS)
I am using TimeShift to backup my system.

Just a couple hours ago I though to try tick the checkbox at (launch TimeShift) TimeShift → Settings → Users → tick the checkbox "Include @home… "

I tried, snapshot, create a file, edit, reboot, edit… snapshot… etch.

Whenever I TimeShift → Browse I can see many folders… my latest with name “2022-08-09_11-19-09”

All /home files and folders are already there in each snapshot.

I hope if this helps!

1 Like

The reason is that if you restore a snapshot from last week and have home enabled, it rollback all your personal data to last week which in most cases would be bad.

2 Likes

That would be a real bad thing.
Just for me trying and practicing I did a restore and I found a checkbox asking me if I want to restore @home, so I did not check it as the image shows.
TimeShift is taking automatically snapshots hourly.

I wonder if this is OK?
Maybe I should consider studying more about “rsync” and manually taking snapshots to folder(s) under “/run/timeshift/3733/backup/timeshift-btrfs” or something like that!

EDIT: I might study more about snapper perhaps or manually BTRFS command to snapshot @home!

1 Like

So as long as you are careful to not check that box you are fine.

1 Like

This sounds great… :tada:
For one time… I did something right! :rofl:

I take this as a “certification” because it comes from @dalto

I found I can browse through Dolpin all @home snapshots, so I assume I can copy whatever I need from the snapshot to my /home folder, wherever I want.

Yes.

1 Like

So, in my case to KISS, I think no need for other stuff (snapper, rsync… above post) I would better leave it this way. TimeShift only.
(but this does not mean I won’t study other options)

Just keep in mind what @dalto said: if you forget about that check box, you can overwrite important files in your home directory with their earlier versions (or delete them entirely if they came into existence after the snapshot was taken). Also, keep that in mind if you are restoring a snapshot from the command line, where there are no check boxes… Make sure home is not restored.

So, don’t forget about it.

Also, keep a backup on a separate, external drive. Snapshots are not backup.

1 Like

Don’t worry… sure I won’t forget (hopefully).

Even if this happened, I can still through Dolphin browse to the /home snapshots and copy/paste whatever files!

Thank you for caring.

Are sure? I think timeshift actually replaces the target and it is possible that it consumes the snapshot during the restore. It has been a little while since I looked at it though.