backup ubuntu server to external hard drive and restore it | cli timeshift rsync automated
Channel: linux-syr
Date: 2022-08-27

timeshift is a system restore utility that creates snapshots of the system at regular intervals. These snapshots can be restored at a later time to undo system changes. Creates incremental snapshots with rsync or BTRFS snapshots with BTRFS tools.
In this video we will create and restore a system image. We will use the command line interface.
first you need to format your external harddrive to ext4 (file system):
df -h 
sudo umount /dev/sdb4
sudo mkfs.ext4 /dev/sdb4 

now you can remount yr backup drive (if get error, reboot, or reconnect harddrive:

sudo mount /dev/sdb4

to create backup on external drive:
sudo timeshift --create --comments "my new backup" --snapshot-device /dev/sdb4

to create local backup:
sudo timeshift --create --comments "my new backup" --tags D

showing backups:
timeshift --list --snapshot-device /dev/sdb4

restore backup:
timeshift --restore --snapshot '2022-08-27_16-29-08' --target /dev/sdb4
or try:
sudo timeshift --restore --snapshot-device /dev/sdb4

to delete:
timeshift --delete --snapshot '2022-11-12_16-29-08'

Create a new snapshot (if scheduled):
sudo timeshift --check

note: my disk was sdb4, yours might be sda4 or sdb2 and so on.

FAQ:
do timeshift snapshot backup user data?
User Data is Excluded by Default
Timeshift is designed to protect system files and settings. It is NOT a user-backup tool and is not meant to protect user data.This backup includes all the system files and settings like network config and repo, installed services—and no user files or documents.