Backing up Couldkey Gen2 + to Unraid

 
Untitled.png
 
 

Backing up Couldkey to remote storage

Fairly simple one this time, Was looking to make sure my cloud key had a backup of everything. Sadly I found while it does auto backup it only does so Locally.

So with the help of Rclone and a file share on Unraid, I have got a way of keeping the files off the device in case of failure.

Unraid Set-Up

You will need to create the below items

Unraid User

Unraid Share with Read/Write permissions for the newly created user.


Cloudkey Set-Up

First Rcone needs to be installed this can be done by inputting the below command.

curl https://rclone.org/install.sh | sudo bash

Next, we need a folder to mount our share to.

mkdir /mnt/backup

Now open nano and enter the below. Replacing <user>, <password>, <ipofserver> and <share>.

#!/bin/bash

mount -t cifs -o username=<user>,password=<password> //<ipofserver>/<share> /mnt/backup

rclone sync /etc/unifi-protect/backups /mnt/backup/protect

cp -a /srv/unifi-protect/video /mnt/backup/protectvideo

rclone sync /srv/unifi/data/backup/autobackup /mnt/backup/unifi

Save this file as unifi.sh

Now we make it executable with the below command.

Chmod +x unifi.sh

Lastly, now add the below line to your crontab

0 1 * * * /root/unifi.sh

This will backup your backup files and video at 1am daily.