Backing up a headless Linux embedded HQPlayer server

Although not strictly an HQPlayer question I was wanting to backup my Ubuntu server. I think it wouldn’t be too difficult to rebuild from scratch but I’d still like to know something about best backup practice.

I was thinking that I could use a USB stick and rsync to it. Would this command work?

sudo rsync -aAXv --delete --exclude={“/dev/“,”/proc/”,“/sys/“,”/tmp/”,“/run/“,”/mnt/”,“/media/*”,“/lost+found”} / /mnt/usb/

Would this capture everything?

Would this recover the HQPlayer licence files? I assume yes.

You could just create a full disk image…

But regarding HQPlayer license key file, it is better to just backup the original in a safe place. It doesn’t consume much space.

I’ve managed to create a full image backup using rsync but initially I was unable to unmount the usb stick because the system was still flushing files from the cache onto the stick. Not sure why it says the backup has finished when it hasn’t. Couldn’t sync so had to reboot and then check consistently with the backup. Everything looks fine but in future I will throttle back write speed to USB.

I’m fairly happy I can rebuild the server from scratch anyway but being able to rebuild from a backup will still be handy.

I didn’t know it is possible to create a full image backup with rsync. I’ve been usually doing that with “dd”. And of course on a filesystem that is not mounted.

I used an exclusion list but from what I’ve read it can be done on a running system with rsync. The proof of the pudding is to do a restore but I won’t do that until absolutely necessary so I’m not 100% sure what I have will work.

It won’t backup partition tables, EFI/rootfs filesystem differences, device nodes, etc. But depends on your specific goals of course…

Rsync operates at the file level not the block level so yes it won’t cover what you mentioned. dd would give you a perfect copy. It would be nice if I could test a recovery so I suppose all it would need would be to swap out the NVME although it wouldn’t be identical.