3

Screenshot showing backup appI now use an external 2 TB HDD to store backups in case of a system crash. If Ubuntu fails to boot for any reason, how do I use the external HDD to recover the system to its full glory with all the docs, pictures, music, videos, and other files?

Do I need to boot it from the boot menu for recovery?

K7AAY
  • 17,705
Mark
  • 355

2 Answers2

4

I'm listing this as an answer because I've spent years coming up with a solution that I believe should be considered for most users who really want a backup strategy they can depend on.

[Some may fairly argue my response does not directly answer the question asked as far as HowTo with the built-in backup. I just was hoping to help anyone searching backups for Ubuntu here. I do not expect this to be the selected answer. I've gone around-the-wheel with rsync, deja dupe, duplicati, bacula, flyback, timevault and many more. They all have strengths and weaknesses.]

Monthly: CloneZilla Image

You can add a line to your Grub menu to boot from a local CloneZilla ISO and then send the backups to a storage medium of choice (options like AWS S3, NFS server, tethered/attached drive). I reboot and hit the Grub choice and go to bed on the 1st of the month. You could even automate this more if you like, but this works great for me.

Daily: Borg Backup

I have this run 3 times a day on a systemd timer, at about 6-hour intervals ... 6 AM, Noon, 6 PM. Again you have flexibility on where to store the backups. I prune and keep the last 14 days and one from each month for 3 years. It deduplicates so the sizes are remarkably small.

Restoring with CloneZilla is a full image, very easy. Borg Backup has great documentation and you can extract to a temporary folder and do as you must.

Last, I do this on a 2 drive dual boot system. It allows me to be "reckless" at times and try things I never would have, knowing I can revert the system to 6 hours ago.

Example of my Grub entry for CloneZilla ... it even works on Wifi with a little effort! In brief it connects to my wireless network and uses an NFS mount point on a server.

menuentry "Clonezilla Auto" {
loopback loop (hd0,1)$isofile
linux (loop)/live/vmlinuz boot=live union=overlay username=user hostname=nuc2 \
    config NOSWAP edd=on nomodeset locales="en_US.UTF-8" keyboard-layouts="en" \
    components quiet nodmraid toram=filesystem.squashfs nosplash findiso=${isofile} \
    ocs_prerun=\"sudo service network-manager start \" \
    ocs_prerun1=\"sudo sleep 1 \" \
    ocs_prerun2=\"nmcli radio \" \
    ocs_prerun3=\"sudo sleep 10 \" \
    ocs_prerun4=\"sudo nmcli device wifi connect SOMENETWORK5G password someP@$$Word3# \" \
    ocs_prerun5=\"dhclient -v wlp1s0 \" \
    ocs_prerun6=\"iwconfig  wlp1s0 power off \" \
    ocs_prerun7=\"mount -t nfs4 192.168.1.2:/partimag/nuc2 /home/partimag -o noatime,nodiratime,rsize=32768,wsize=32768 \" \
    ocs_live_run=\"ocs-sr -q2 -j2 -z1p -i 0 -fsck-src-part-y -sc -p true savedisk autoname all \" \
    ocs_postrun=\"ls -dt /home/partimag/*/ \| tail -n +7 \| xargs rm -rf\" \
    ocs_postrun1=\"sudo sleep 5 \&\& sudo poweroff \" \
    ocs_live_batch=\"no\" 
initrd (loop)/live/initrd.img
}
Mark
  • 1,531
3

Since you now use the default Déjà Dup app, you would need to reinstall Ubuntu, reattach the external HDD, then launch Déjà Dup and restore from within it.

Déjà Dup is a GUI for Duplicity. The encrypted tar files which Déjà Dup makes to back up the /home directory contents can be manually opened, and specific files extracted to selectively restore specific files and directories at any time.

The earlier answer is much more comprehensive, and discusses why to choose what to use and how to use it. Learning what's out there and making an informed decision about how to protect your data is extremely useful. I would not be happy with just one backup in an drive stored in the same place as the computer, as that's won't protect against file, flood, quake, or theft.

K7AAY
  • 17,705