Re:Timeshift: System Restore Tool for Linux
by magicalhippo on Tuesday July 23, 2024 @11:24AM
(#41046952)
Thanks, sounds interesting. So you create a snapshot, then let kopia process that snapshot rather than the live filesystem, and then remove the snapshot?
> I suppose if it only walked files it knew were changed it would be a lot faster.
Right, for me I'd want to set it up to do the full disk, so could be millions of files and hundreds of GB. But this trick should work with other backups software, so perhaps it's a viable option.
Exactly so.
Here's the script, should it be of benefit to someone, even if it of course needs to be modified:
#!/bin/sh
success=false
teardown() {
umount /mnt/backup/var/lib/docker || true
umount /mnt/backup/root/.cache || true
umount /mnt/backup/ || true
for lv in root docker-data; do
lvremove --yes /dev/hass-vg/$lv-snapshot || true
done
if [ "$1" != "no-exit" ]; then
$success
exit $?
fi
}
set -x
set -e
teardown no-exit
trap teardown EXIT
for lv in root docker-data; do
lvcreate --snapshot -L 1G -n $lv-snapshot /dev/hass-vg/$lv
done
mount /dev/hass-vg/root-snapshot /mnt/backup
mount /dev/hass-vg/docker-data-snapshot /mnt/backup/var/lib/docker
mount /root/.cache /mnt/backup/root/.cache -o bind
chroot /mnt/backup kopia --config-file="/root/.config/kopia/repository.config" --log-dir="/root/.cache/kopia" snap create / /var/lib/docker
kopia --config-file="/root/.config/kopia/repository.config" --log-dir="/root/.cache/kopia" snap create /boot /boot/efi
success=true
Re:Timeshift: System Restore Tool for Linux
by magicalhippo on Tuesday July 23, 2024 @02:26PM
(#41049212)
Awesome, thanks!
I just make a full dedupped backups from LVM snapshots with kopia, but I've set that up only on one system, on others I just use kopia as-is.
It takes some time, but that's fine for me. Previous backup of 25 GB an hour ago took 20 minutes. I suppose if it only walked files it knew were changed it would be a lot faster.