My goal is to back-up as much of the system as is possible. I realize I only need to, realistically, back up /homes and /etc, but for purposes of quickly restoring my actual system state in the event of e.g., an accident with sudo rm -rf (again), I’d like a way to, for example, quickly restore the /var/ directory.
What folders can I exclude as being virtual filesystems/temporary/otherwise not worth backing up? Here’s what I’m excluding in deja-dup, logged in as root.
My thought was to set up deja-dup to do this, but is there an easier/better way? I’d prefer just to have a whole system image I can mount on another linux box and copy files back to the boot drive from, but I’m not sure how to do this, and especially not sure how to do it on a schedule. In the meantime, deja-dup is better than no backup at all.
I would appreciate any advice. Thanks!
(P.S.: @Strit , thanks for turning me on to deja-dup. It’s super-easy to use, even if I can’t figure out how to get automatic backups to actually run yet.)
I use Timeshift for the system portion of the backup. It takes care of all the system files and can be set to run about as often as you want it to run. By default, it ignores the home folder (which is what you would probably want since I restore would also revert all the recent work that you have saved).
As for the home folder, that is where I use Deja Dup. With it, I have it back up the entire home folder so that I can restore any work that I have done. In turn, it ignores all of the system folders. And since it uses incremental backups, each following backup isn’t that large.
Question re: DejaDup: If I later go in and adjust the exclusions, will it cause problems? I just realized I should have excluded the .caches directory in my home folder…
Question 2 re: DejaDup: Will it still work if I’m not logged in as root (the user that set up the backups)? For obvious reasons, I don’t want to be logged in as root all the time, and I can’t figure out how to ask systemd if there’s a daemon running. (I haven’t figured out what it’s called yet.)
Question 3 re: Timeshift:timeshift-bin won’t install for me from the AUR. Says it’s not available for the aarch64 architecture. I remember there being a way to bypass this, but I can’t remember how.
(I’m ignoring the slightly newer package that looks like it’s a bit more cutting edge, since going with a stable release seems a better idea for a system-files backup.)
Thanks, @Strit . I’ll try that one in the morning.
That’s the “slightly newer” package I was ignoring. The weird version number (20.11.1+3+g08d0e59-2) made me think it was a GitHub nightly or something and put me off.
Deja Dup isn’t designed to run as root (to the best of my knowledge). Since its primary focus is on backing up the home folder, it has access to it with only the credentials of the home folder owner.
I have never tried running it as root, so I can’t say for sure.
As for Timeshift, it will back up your system without having to log into root.
@johntdavis84 , there is a timeshift option to include the hidden folders of your /home/$USER directory since at this locations many program settings etc. are stored. If you execute frequently a timeshift backup then I would recommend to include those hidden folders but certainly, as alyways on Linux - it’s up to you.
Why not just use timeshift or deja-dup for the entire system? I understand there are some technical reasons, but I’m not exactly clear what they are.
At the moment, I’m splitting duties between deja-dup for home directories and timeshift for everything else, as that seems to be the current meta and therefore all the docs and help files I Find online are likely to assume that’s what I’m doing.
@BSakura , my thought was to run it as root so I could back up the home directory for the root user as well, just in case. If that doesn’t seem to work, I’ll revert to just doing my personal home directory.
Per @Wollie 's point, will deja-dup pick up .dotfiles and .directories?
@Strit I’d like to have timeshift save into a CIFS/SMB network share, but it only wants to save into a /timeshift directory on a mounted ext4 drive, so I’m considering sam-linking /timeshift the the particular mounted network folder where I want these files stored. Good idea? Bad idea?
I rarely create symbolic links. I’m guessing I’ll want to create this one with sudo? Timeshare seems to need root privileges to run correctly, but I’m not sure what that means for creating the symbolic link.
@zoner Timeshare flat out states it prefers BtrFS during the set up wizard (it was apparently designed for that). Deja-dup didn’t say anything either way during setup.
My NAS is making intimidating spinning drive noises as we speak, so I think I set up timeshift correctly.
Initial snapshot is estimated to take ~90 minutes. Given how empty my SSD is (I’m only using about ~50 GB total, and ~3.5G of that is home folder stuff, so let’s say timeshare is at most backing up no more than 46.5 GB), I’d suggest devoting significant time for this process on first run. (Not that you’ll be interacting with it when it’s going, but I’m not hot on interacting with a system doing major disk operations when I don’t have to).
EDIT: Initial Timeshift backup of the above is 7.78 GB. So, the backup only takes up about 16.7 percent of the space of the source, according to back-of-the-envelope math. Does that seem right? Great compression…unless I’ve screwed up something.
htop suggests memory usage is negligible, though CPU usage is considerable across all 4 cores on the Pi. I’d not say it’s pegging them, but it’s definitely taking advantage of them.
to my knowledge it creates writable snapshots, not good
it can’t create differential snapshots to BTRFS formatled external drives with btrfs send → btrfs receive
I use snapper to make snapshots and snap-sync to create differential backups through SSH tunnels.
I snapshot and backup / “root” and /home “home”, excluded /var except /var/lib which is contained into “root” snapshots/backups. Snapshots are automatically made before and after installing packages with pacman/pamac/yay (thus AUR is included) of “root” and “home”. For “home” additional snapshots are made with timeline every hour, 12 hours, 2 per day, 7 per week, 1 per month, 12 per year. Backups are made one per day. With grub-btrfs i have the least 24 snapshots of root as GRUB menuentries and can boot into older snapshots, installations of my system upto running DE/GUI.
Remark: snapshots of / = “root” contains anything except /home and sub folders and /var and sub folders. Only folder /var/lib is excluded and included into “root” snapshots/backups. This setup is needed because in /var/lib are stored libraries and the pacman/pamac configuration of installed packages. If we want to rollback a system we don’t have to break the relationship between the system in / etc.pp. and /var/lib. In as example /var/log or /var/cache are files we don’t want to backup nor to restore on a rollback to recover the system. LOG-Files should anytime contain the last logs.
Remark2: " with timeline every hour, 12 hours, 2 per day, 7 per week, 1 per month, 12 per year" That means: the last 12 hour one snapshots every hour, last day 2, last 7 days one per day, and last 12 months one per month and so on. In one year thus 1+12+7+1+12 snapshots in result. That’s with BTRFS not much because anything is differential, only new things consume space.