PSA Mint + Timeshift + KVM hosters: /var/lib/libvirt is excluded by default from snapshots
from BonkTheAnnoyed@piefed.blahaj.zone to selfhosted@lemmy.world on 07 Jul 01:06
https://piefed.blahaj.zone/c/selfhosted/p/854511/psa-mint-timeshift-kvm-hosters-var-lib-libvirt-is-excluded-by-default-from-snapsho

Converted my daily driver to my vm/docker host. I assumed all my images would be included in timeshift’s snapshots, but… nope!

Fortunately I figured it out before I needed it. was testing my backups as part of prep for wiping everything and going to headless debian, found libvirt was missing.

Edit: Added rsync tag to reflect the comments section, which really deserves its own thread.

#kvm #selfhosted #timeshift

threaded - newest

confusedpuppy@lemmy.dbzer0.com on 07 Jul 02:43 next collapse

Timeshift is the reason I learned how to use rsync. I wrote my own script that made a more complete backup and can automate multiple incremental backups with a customizable max number of backups.

It’s simple and so much more reliable. Even when I forget to test my backups, they still work when the time comes.

At least Timeshift taught me how to use rsync, so there’s that.

BonkTheAnnoyed@piefed.blahaj.zone on 07 Jul 03:38 collapse

Yes, I definitely make use of rsync for backups of specific directories, so, in this case, no data would have been lost if I had relied solely on timeshift. But it’s a very convenient way of snapshotting the whole system.

Timeshift is essentially a gui on top of rsync anyway, if you look at what it’s doing behind the scenes.

confusedpuppy@lemmy.dbzer0.com on 07 Jul 05:02 collapse

Timeshift is essentially a gui on top of rsync anyway, if you look at what it’s doing behind the scenes.

That’s the reason why I chose to learn rsync. I was frustrated with Timeshift. It failed to restore some changes multiple times. It gave me issues with docker. It also had default excludes that were annoying to change as well.

I then learned how to make a complete system backup with rsync itself. /, /boot/ and /boot/efi/ has to be done on separate rsync commands. Basically one command per partition.

A restore involves flipping the source and destination in the rsync command. It also allows me to boot into a live USB and perform a restore in the event that I really mess up and can’t perform a restore normally through the installed OS.

By leaving behind the GUI, I got a lot more flexibility. It’s also a lot more reliable and I’ve had a lot less restore issues.

Cyber@feddit.uk on 07 Jul 05:56 collapse

I was looking into this recently and un-convinced myself that rsync was handling all the symlinks and permissions correctly.

What’s your command options? I was using -Prvtz for ages, then thought I needed an Aa too (from memory)

confusedpuppy@lemmy.dbzer0.com on 07 Jul 14:35 collapse

I’m going to post all the commands I use because I think that may be easier to follow. All the commands I’m posting will include the –dry-run option so if anyone tries to copy/paste this into their terminal, no actions will be taken. Instead it will show you what is going to happen if you ran the command without any changes.

As I mentioned before, each partition will require it’s own command. The easiest way is using lsblk. Below is my current setup and here you can see I have 5 partitions. One partition is a swap so I will only be working with 4 partitions, /, /boot, /boot/efi and /home:

dell:~ $ lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme0n1               259:0    0 953.9G  0 disk  
├─nvme0n1p1           259:1    0   500M  0 part  /boot/efi
├─nvme0n1p2           259:2    0  62.5G  0 part  
│ └─luks1-dell        253:0    0  62.5G  0 crypt 
│   ├─vg_dell-lv_boot 253:1    0   500M  0 lvm   /boot
│   ├─vg_dell-lv_swap 253:2    0     8G  0 lvm   [SWAP]
│   ├─vg_dell-lv_root 253:3    0    38G  0 lvm   /
│   └─vg_dell-lv_home 253:4    0    16G  0 lvm   /home
├─nvme0n1p3           259:3    0   600G  0 part  
├─nvme0n1p4           259:4    0 270.9G  0 part  
└─nvme0n1p5           259:5    0    20G  0 part 

It’s good to first check what partitions you are using. My Raspberry Pi’s (ARM) only have / and /boot for example.

The following rsync commands are what I use to make a complete backup of my system. I do exclude a number of directories because they are for temporary stuff like ram, processes or even devices/drives. It’s also important to exclude the specified backup directory to avoid recursing into the backup directory and filling up your storage space.

I have a manual backup location and automated backup location. The following is for my manual backup location in /backup/main on my system. This location can be changed to wherever you want your backup.

# Backup
# /
rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --numeric-ids --delete --exclude=/backup/* --exclude=/boot/* --exclude=home/* --exclude=proc/* --exclude=sys/* --exclude=dev/* --exclude=tmp/* --exclude=run/* --exclude=mnt/* --exclude=media/* '/' '/backup/main/'

# /boot/
rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --numeric-ids --delete --exclude=lost+found '/boot/' '/backup/main/boot/'

# /boot/efi/
rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --numeric-ids --delete --exclude=lost+found '/boot/efi/' '/backup/main/boot/efi/'

# /home/
rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --numeric-ids --delete --exclude=lost+found --exclude=.cache/* '/home/' '/backup/main/home/'
`rsync` restore commands

# Restore # / rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --numeric-ids --delete --exclude=/backup/* --exclude=/boot/* --exclude=home/* --exclude=proc/* --exclude=sys/* --exclude=dev/* --exclude=tmp/* --exclude=run/* --exclude=mnt/* --exclude=media/* ‘/backup/main/’ ‘/’ # /boot/ rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --numeric-ids --delete --exclude=lost+found ‘/backup/main/boot/’ ‘/boot/’ #/boot/efi/ rsync --dry-run --archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-r

brewery@feddit.uk on 07 Jul 08:19 collapse

Very nice! I’m a big fan of homepage. What do you use for the upcoming TV shows widget?

gajahmada@awful.systems on 07 Jul 17:36 collapse

I think you commented on the wrong post there.