2

I'm looking to take a whole system backup and store it on S3. Something that could be good enough to restore my entire system. But I've been told that using dd/rsync to capture the root directory will save a lot of extraneous files that I wouldn't need to restore the system.

In the event that I had to reply on this backup, I would need to restore:

  • The home directory
  • All installed programs
  • All customizations throughout the system, such as edits to the Openbox configuration file, etc

The command I see recommended here is:

sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt

Is it possible to go lighter than that?

Eliah Kagan
  • 117,780
  • This won't save boot loaders and so forth, so restoring from it will include installing those manually. What software do you have installed? For me, reinstalling takes ~1hr, as I have a fair Idea of what software I need. I only care about backing up ~. The rest is trivially restorable. – vidarlo Jun 16 '19 at 12:07
  • 1
    Do you really need "all installed programs", or is it okay to download them later based on current package configuration? I.e. would saving /usr/local, /home, and /etc be sufficient? – Ray Butterworth Jun 16 '19 at 13:12

2 Answers2

4

You might look at a combination of Backups (Déjà Dup) for your /home, and Timeshift for the system stuff. Otherwise, use Macrium Reflect to clone your entire disk/partition.

The closest thing to a Windows-like restore point is by using Timeshift. I use it to save snapshots to an external USB hard drive. Although it can, it's normally not used for backing up your /home directory, just system-level changes. Use Backups (Déjà Dup) for backing up /home files.

Timeshift is a system restore utility which takes snapshots
of the system at regular intervals. These snapshots can be restored
at a later date to undo system changes. Creates incremental snapshots
using rsync or BTRFS snapshots using BTRFS tools.

More information at https://github.com/teejee2008/timeshift

For pre-19.04 users, add the PPA:

sudo add-apt-repository -y ppa:teejee2008/ppa

And install with:

sudo apt update
sudo apt install timeshift
Fabby
  • 34,259
heynnema
  • 70,711
  • An edit and an upvote! ;-) – Fabby Jun 17 '19 at 21:50
  • Thanks! I'm already using Timeshift in combination with Clonezilla. The former, as you say, to roll back to a snapshot (in the event that is required). The latter to save my system if stuff really goes belly up (although I learned recently that you can use Timeshift as a CLI, which would have saved me reinstalling my last system the last time I had to when I couldn't get passed GRUB). – Daniel Rosehill Jun 18 '19 at 15:05
  • @DanielR keep in mind that Clonezilla won't clone to a smaller disk than the source. This means that you probably won't be able to restore from a clone backup. – heynnema Jun 18 '19 at 15:20
0

From: Bash script to backkup/clone Ubuntu to another partition

rsync -haxAX --stats --delete --info=progress2 --info=name0 --inplace  \
      /* "$TargetMnt"                                                   \
      --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}

The script also updates /boot/grub/grub.cfg and /etc/fstab so you can boot your backup.