If you want to backup your HOME and only your HOME, then use a command like this:
Code:
sudo /usr/bin/rdiff-backup \
--exclude-sockets --exclude-device-files --exclude-fifos \
--include /home \
--exclude '**' / /Backups/
Ref: Https://ubuntuforums.org/showthread....9#post14125329
You can run that same command over and over to get different versions. Only changed data will be transferred. It is very efficient both in time and space used.
To prevent it from filling up the backup storage, you'll want to trim the oldest backup sets off. I typically keep 90-180 days of backup sets, so to remove any that are older than that, use
Code:
sudo /usr/bin/rdiff-backup --remove-older-than "90D" --force /Backups
The most recent backup appears as a mirror, so restoring files is just a copy from the backup area. If you need older versions of a file, directory, everything, then rdiff-backup has a --restore-as-of option that takes times, dates, versions ... it is very flexible.
The only caveat is that the target storage, /Backups, in my example, needs to be a Unix file system. Not NTFS. Not exFAT. Not FAT32. Ext4 or f2fs are good choices.
That's really all you need. Put those 2 commands into a {file}, chmod +x {file} - now it is a "script". Mount the backup storage to /Backups and run the script. Run it daily or weekly, then sleep better knowing you have backups for everything in any HOME directories on the system. This will get all the data for all the userids on the system, not just 1. Remember, Linux is always a multi-user OS.
This really isn't enough for a "system" backup, but for many people, it is more than sufficient. For system backups, I have a little longer script and more directories in the "--include" list.
Of course, you'll need to ensure the space for the source files/directories will fit into the target storage.
Code:
sudo du -sh /home # Check the source
sudo du -sh /Backups # Check the target
For 90 days of versioned backups, you'll want the target area to be 30% larger than the source files. Of course, YMMV.
Bookmarks