Skip to main content

Backup and Restore Ubuntu based systems

Use apt-clone, deja-dup and some shell scripts to backup and restore ubuntu based systems:

Requirements:

install
  • Deja-Dup

  • duplicity as a terminal command, if you want to restore that way.

Backup

sudo apt install apt-clone
mkdir ~/backup
cd ~/backup
sudo apt-clone clone apt-clone-state-ubuntu-$(lsb_release -sr)-$(date +%F).tar.gz
flatpak list --columns=application --app | tee flatpak.lst

Run DejaDup and store the backup in ~/backup/dejadup in this example.

You can probably also run DejaDup to restore into a folder somewhere, instead of using duplicity below.

Restore

cd ~/backup
sudo apt-clone restore apt-clone-state-ubuntu-$(lsb_release -sr)-$(date +%F).tar.gz
xargs flatpak install < flatpak.lst

sudo su
# change myuser
PASSPHRASE="" duplicity restore file:///home/myuser/backup/dejadup /root/restore
cp -r /root/restore/home/myuser/. /home/myuser
chown myuser:myuser /home/myuser -R

Now reboot