Sadly, Ubiquiti offers no way to backup the videos stored on their NVR and Cloudkey appliances. This sucks if you have a fire, or breakin, and the device is stolen or otherwise compromised.

Checking various reddit and ubiquiti community posts, it doesn’t look like a proper solution is coming either (been asked for for years!)

So, I decided to try and fix this issue myself.

Note this takes a LONG TIME to backup if you have continuous recording, or, lots of alerts, so it might not work for you – for example on Starlink, it takes approximately 4 hours for me to backup a single day of alerts from only 6 cameras. Not optimal, but, at least I have backups twice a day I guess.

Anyway, here’s how to do this for yourself if you want.

  1. Login to Backblaze

  2. Create a new bucket for your backups. I turned encryption on, but that is up to you.

  3. Retain the Bucket ID, Endpoint ID

     Bucket ID: <LONG STRING OF NUMBERS>
     Endpoint ID: s3.us-west-002.backblazeb2.com
    
  4. Within backblaze, now click ‘App Keys’ on the left

  5. Click ‘Add Application Key’

  6. Name your key and set these settings;

     access to:** the bucket you just created for your NVR backups
     access level:** read/write (so you can restore if needed) 
    
  7. It will provide some information for you to retain which you need to store.

     keyID: <long string of numbers>
     keyName: <the_name_of_your_key>
     applicationKey: <long string of numbers>
    
  8. Next, ssh to your cloudkey and install backblaze-b2

     # apt install backblaze-b2
    
  9. Then, do the following to authorize your account

     # backblaze-b2 authorize_account <APP_ID>
     # backblaze-b2 authorize_account <KEYID_OF_YOUR_BUCKET> 
    

when prompted, add the application key of your bucket.

  1. Then, list the buckets you have available, it should show one which you configured previously on backblaze.

    # backblaze-b2 list_buckets
    

    it should show an error that you’re limited only to one bucket, the one you’ve setup for your NVR. This is fine. Proceed.

  2. Now we’re all set to setup the backups. Since this is my personal NVR and it’s only for security purposes I didn’t want to setup duplicity or anything for encryption as Backblaze-B2 uses TLS anyways. However you can do so, and I found a cool tutorial here. I’ve turned on encryption on my bucket which should be sufficient for my needs.

  3. Let’s test a dry-run of the videos

    # backblaze-b2 sync --dryRun --keepDays 30 --threads 5 --excludeAllSymlinks /srv/unifi-protect/video/ b2://<<BUCKET_NAME>>/
    
  4. This should output something like

    upload 2022/01/13/68D79ADF56B9_0_rotating_1642109652208.ubv
    upload 2022/01/13/68D79ADF56B9_0_timelapse_1642110047421.ubv
    upload 2022/01/13/68D79ADF56B9_2_rotating_1642109651962.ubv
    upload 2022/01/13/68D79ADF56B9_2_timelapse_1642110887295.ubv
    upload 2022/01/13/E063DA00A047_0_rotating_1642109590189.ubv
    upload 2022/01/13/E063DA00A047_0_rotating_1642122166120.ubv
    
  5. Now that it works, modify your command to remove the dryrun command.

    # backblaze-b2 sync --keepDays 30 --threads 5 --excludeAllSymlinks /srv/unifi-protect/video/ b2://<<BUCKET_NAME>>**/
    
  6. Now you can schedule this command to run at whatever interval you want via Cron on the machine.

Note, I have not tried this through a firmware update, it’s likely you have to reset this all up after each upgrade. Also as mentioned above, be aware these updates can (will) take forever, so it’s not really a great solution for up to the second backups, but it does work.

Mainly storing this for my reference 🙂