As if drive corruptions, accidental deletions, and other unforeseen events don't already pose a threat to your precious data, you’ll also want to watch out for ransomware. For the uninitiated, it’s a type of malware that encrypts your storage volumes, rendering your files inaccessible unless you wire your hard-earned money to a malicious actor.

Thankfully, creating frequent backups and storing them across multiple devices in your home network can help you stay one step ahead of hackers. Better yet, you can use some automation tools to spare yourself the trouble of manually backing up your precious data. If that sounds worth your while, here’s a detailed guide on how you can put together a fully-automated backup stack using Veeam Backup Agent, Roboclone, and Windows Task Scheduler.

👁 Running n8n on Proxmox
4 must-have n8n automations for your home lab

Integrate n8n's automation prowess into your experimentation server with these ideas

Setting up Veeam Backup Agent

At the crux of our automation system lies Veeam Backup Agent, a freemium tool that lets you create selective and full backups of your daily driver. It’s fairly easy to use, and you can even set up the backup frequency to partially automate the overall process. Assuming you’re on Windows 11, here’s how you can configure it:

  1. Head to Veeam’s website and download the .zip file for Veeam Backup Agent after registering on the platform. Don’t worry, you don’t have to spend a penny to create a Veeam account.
  2. Extract the .zip file you downloaded earlier and run the setup.exe file with administrator privileges.
  3. Hit Next on the Recovery Media tab.
  4. Click on the Browse button and choose the location where you want to save the recovery image.
  5. Hit Next twice, tap the Finish button and wait for the wizard to create the recovery image.
  6. Once the Veeam Backup Agent window pops up, click on the menu button, hover your cursor over the Job, and tap Edit job.
  7. If you want, change the Name of your Backup Job and hit Next. Be sure to press the Next button after each step in this section.
  8. Select your preferred Backup method.
  9. Choose the Destination of the backup image. I’ve gone with a password-protected SMB share on my NAS, but you’re free to choose an external drive or an iSCSI disk/NFS share.
  10. Press the Browse button inside the Local Storage/Shared Folder tab and select the directory where you want the app to store the backup files.
  11. Choose the Backup schedule that best matches your needs.
  12. Double-check all settings and hit the Finish button.
  13. Tap the Backup Now button and wait for the app to finish backing up your PC.

Creating a Robocopy script

By now, you may have realized that the free version of Veeam lets you create a single backup job. But since we’re trying to build a robust backup system that can survive the brunt of ransomware attacks, the next step involves adding some redundancy to our storage files. So, we’ll use the Robocopy utility built into Windows 11 to clone the backup directory to separate drives and/or NAS units. To do so,

  1. Open the Run utility by pressing Win+R and hit OK after typing notepad into the Search bar.
  2. Type robocopy followed by the source of the backup file (the directory where you have the files created by Veeam Backup Agent) and the destination location (the folder where you plan to store the clone of your backups) alongside a couple of extra arguments.
    robocopy \source\path \destination\path /e /b /LOG+:D:\log.txt
    The /e argument lets Robocopy clone all folders (including empty subdirectories), while the /b argument runs the command in backup mode, ensuring you won’t encounter access privileges issues. The /log command creates a log file containing the details of the operation, and it comes in real handy when things go wrong.
  3. If you’re using a protected share on your NAS, you can invoke the net use command to sign in to the shared folder with the correct credentials.
    net use \\share\path /USER:username password
  4. Hit Ctrl+S, switch the file type to All Files, and make sure you end the file name with the .bat extension.

Automating the Robocopy script

Although the Robocopy .bat file can clone your Veeam backup, you’ll have to run it manually every time you wish to sync files across your devices. So, we’ll use the Windows Task Scheduler to automate the Robocopy script’s execution.

  1. Open the Run utility by pressing Win+R before typing taskschd.msc into the Search Bar and hitting OK.
  2. Click on Create Task.
  3. Inside the General tab, grant a Name to the new task and enable the checkbox next to Run with highest privileges.
  4. Switch to the Triggers tab, click on the New option, and pick the Frequency of the clone operation under the Settings panel.
  5. Head to the Action header, tap New, and use the Browse button to pick the Robocopy script you created earlier.
  6. Finally, tap the OK button to add the backup task to the Task Scheduler.

Say adios to your ransomware woes with an automated backup stack

Assuming you’ve followed all the steps properly, you should have a reliable automation suite for your backup needs. Personally, I use Veeam Backup Agent to create the primary backup on my LincStation N2 NAS, which then gets synced with another backup folder on my TerraMaster F4-424 Max storage server. Since it’s possible for malware to spread to these devices, I also clone the backup to an external drive every month to add an extra layer of protection against potential ransomware attacks.