HomeLab Cloud Backups

Hey guys, I have been working hard on my homelab with upgrades, and one thing I’ve wanted to do for a long time is figure out how to encrypt and back up my homelab’s data to my Google Drive as I have 1Tb of free storage space that I don’t use for [hopefully] obvious reasons. I mentioned this desire to one of the senior software developers at work, and he was like why don’t you try rclone? So I started looking into it, and it’s exactly what I’ve wanted - with one caveat. I would like to compress the data I upload first. It mostly just means that my GDrive utilization will be able to scale without me having to actually start paying for it :roll_eyes: as my homelab does.

The other reason that I want to compress the data is that it makes uploading it easier. However, it does put a lot of load on the CPU and makes the whole process take longer. My CPU’s utilization spikes by 10% when the tar command is executed with this Sytemd service:

[Unit]
Description=Run RCLONE backup service to Google Drive
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStartPre=tar --exclude='/home/jellyfin/Music' --exclude='/home/jellyfin/media' -zcvf /root/homelab_backup_latest.tgz /home/
ExecStart=rclone /root/homelab_backup_latest.tgz GoogleDriveEncrypt:

That file is periodically executed by this sytemd timer:

[Unit]
Description=RCLONE Google Drive backup timer

[Timer]
OnBootSec=3min 
OnUnitActiveSec=120h

[Install]
WantedBy=timers.target

I chose gzip mostly because that is what I usually choose with tar, but I’m curious about other compression algorithms that tar supports. My home directory is basically 90% of the homelab’s data that needs to be backed up. Most of the services on my homelab are run by their own dedicated user as a method of security by compartmentalization, and as a result the data and configuration reside in that user’s home directory. I don’t expect there to be a lot that is going to change between updates, so a compression algorithm or flag that only adds files that were updated would be nice.

P.S. I put in the v flag for the tar that way I can have something to look at if I need to debug the backup timer and service. Hopefully it doesn’t fill up my journald log.

You can create a new remote using the “Compress a remote” option. Through the wizard point the compress remote to your usual remote. When doing backups use the compressed remote.

I do something similar for encryption. You need to layer the encryption or compression on top of the actual remote.

I pointedly didn’t do that because the documentation recommended not doing that.