Backup and Restore Ubuntu based systems
Use apt-clone, deja-dup and some shell scripts to backup and restore ubuntu based systems:
Requirements:
- 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
# backup /etc
sudo apt install etckeeper
sudo etckeeper vcs remote add origin $GITHUB_URL
sudo etckeeper vcs push
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
# etc (unverified)
cd /tmp
git clone $GITHUB_URL etc.new
sudo mv /etc /tmp/etc.old
sudo mv /tmp/etc.new /etc
Now reboot