Home › Knowledgebase › KB-572

How to set up and manage automatic backups to a USB drive that only connects on a schedule to protect against ransomware

Summary

This guide helps you troubleshoot and resolve: How to set up and manage automatic backups to a USB drive that only connects on a schedule to protect against ransomware. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

Keeping backups offline is one of the strongest defences against ransomware. If your backup drive sits plugged in permanently, malicious software on your network can encrypt or delete those backups just as easily as your live data. By only connecting your USB drive during a short, scheduled backup window, you dramatically reduce the window of opportunity for ransomware to reach it.

This guide walks you through setting up a scheduled backup that runs while the drive is connected, then safely disconnects the drive when the job is finished. The approach works on both Windows and macOS.

How the Scheduled Offline Backup Approach Works

The concept is straightforward:

For this approach to be effective, the backup window needs to be short and predictable. A 30 to 60 minute window is ideal. The longer the drive is connected, the greater the risk.

What You Will Need

Quick Fix Steps

  1. Prepare and label your USB backup drive.
  2. Configure your backup software to run on a schedule.
  3. Set the software to eject the drive when finished.
  4. Create a recurring reminder to plug the drive in before the backup window.
  5. Test the full cycle end-to-end.
  6. Verify backups by performing a test restore.

Detailed Instructions

Step 1: Prepare and Encrypt the Backup Drive

  1. Connect the USB drive to your computer.
  2. Open Disk Management on Windows (right-click the Start button and choose Disk Management) or Disk Utility on macOS (Applications > Utilities > Disk Utility).
  3. Format the drive as NTFS (Windows) or APFS (macOS) and give it a clear label such as OFFLINE-BACKUP.
  4. Enable encryption for physical security:
    • Windows: Right-click the drive in File Explorer and choose Turn on BitLocker. Follow the wizard to set a password and save your recovery key.
    • macOS: In Disk Utility, select the drive, click Erase, choose APFS (Encrypted), and set a password.
  5. Eject the drive safely.
Anything stored on the drive will be erased during formatting. Make sure the drive is empty or that you have copied any existing data elsewhere first.

Step 2: Configure File History on Windows

  1. Connect the USB drive.
  2. Open Settings > Update & Security > Backup (Windows 10) or Settings > System > Storage > Advanced storage settings > Backup options (Windows 11).
  3. Click Add a drive and select your USB drive.
  4. Click More options to set the backup frequency and how long to keep backups.
  5. Under Back up these folders, add or remove folders to match what you need to protect.
  6. Click Back up now to perform an initial backup.
File History will not automatically eject the drive when finished. For automatic ejection and true scheduled automation, use a third-party tool such as Veeam Agent for Windows (Free) or Duplicati instead of relying on File History alone.

Step 3: Configure Time Machine on macOS

  1. Connect the USB drive.
  2. Open System Settings > General > Time Machine.
  3. Click Add Backup Disk and select your USB drive.
  4. Choose Set Up Disk and enable encryption for backups.
  5. Time Machine will begin its first backup automatically. Subsequent backups run hourly when the drive is connected.

Step 4: Use a Third-Party Backup Tool (Recommended for Automation)

Built-in tools are useful, but dedicated backup software gives you more control over scheduling and post-backup actions. Tools we commonly recommend include:

Whichever tool you choose, configure it to:

  1. Run only during your defined backup window.
  2. Verify the backup after writing.
  3. Execute a post-backup command to eject the drive.

Step 5: Automate Ejection of the USB Drive

On Windows using a Scheduled Task

Windows File History cannot automatically eject a drive. For automatic ejection, use a dedicated USB eject utility such as DevCon or a third-party backup tool with post-job ejection support. If you prefer a manual scheduled approach, use Task Scheduler to remind you to eject the drive:

  1. Open Task Scheduler (search for it from the Start menu).
  2. Click Create Task (not Create Basic Task) for more control.
  3. Give it a name such as Eject Backup Drive Reminder.
  4. On the Triggers tab, create a new trigger that runs Daily at the time you want the backup to finish (for example, 11:30pm).
  5. On the Actions tab, choose Start a program and enter a message or script to remind you to safely eject the drive via the system tray.
  6. Click OK and test the task by right-clicking it and choosing Run.
If you use Veeam Agent Free or Duplicati, configure a post-backup script to eject the drive automatically. Do not rely on the Shell.Application Namespace method, as it targets Control Panel rather than a specific drive letter and is unreliable.

On macOS using launchd

  1. Open Terminal (Applications > Utilities > Terminal).
  2. Create a script file with: nano ~/eject-backup.sh
  3. Add the following line, replacing OFFLINE-BACKUP with your drive label:
    diskutil unmount /Volumes/OFFLINE-BACKUP
  4. Save with Ctrl+O, then exit with Ctrl+X.
  5. Make the script executable: chmod +x ~/eject-backup.sh
  6. Create a launchd plist file to schedule the script. Open Terminal and run: nano ~/Library/LaunchAgents/com.local.eject-backup.plist
  7. Add the following content, replacing yourusername with your actual macOS username:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.local.eject-backup</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/yourusername/eject-backup.sh</string>
        </array>
        <key>StartCalendarInterval</key>
        <array>
            <dict>
                <key>Hour</key>
                <integer>23</integer>
                <key>Minute</key>
                <integer>30</integer>
            </dict>
        </array>
    </dict>
    </plist>
  8. Save with Ctrl+O, then exit with Ctrl+X.
  9. Load the agent into launchd:
    launchctl load ~/Library/LaunchAgents/com.local.eject-backup.plist
  10. To start the agent immediately:
    launchctl start com.local.eject-backup
If you modify the plist file after loading it, unload it first with launchctl unload ~/Library/LaunchAgents/com.local.eject-backup.plist, then load it again.

3-2-1 Backup Principle and Drive Rotation

An offline USB backup is a strong ransomware defence, but it should not be your only copy of data. Follow the 3-2-1 backup rule:

We recommend rotating at least two USB drives. Keep one drive connected for the scheduled backup window, then swap it with a second drive kept offsite. Rotate them weekly or monthly so you always have an offsite copy protected against fire, theft, or hardware failure at your primary site.

Verify and Restore Your Backups

A backup is not reliable until you have proven you can restore from it. Do not wait for a disaster to find out your backup failed.

  1. After the first scheduled backup, open your backup software and browse the backup set.
  2. Select a few representative files and restore them to a temporary folder.
  3. Open the restored files to confirm they are intact and readable.
  4. Repeat this verification monthly.
  5. Perform a full test restore at least once per year to confirm the entire recovery process works.

Troubleshooting

Drive Not Recognised

Backup Window Missed

Ejection Failure

Backup Verification Failure

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket