Backing up data is incredibly important. We dedicated an entire week to raising awareness about the importance of data backups, but there's a way to take your backup strategy to the next level. If you're like me and have automated backups configured per device or simply run manual tasks when using them, there's a handy way to use Wake-on-LAN (WOL) and a NAS to automatically boot devices, back them up, and shut them down without human input.
Why backing up data is important
Don't lose a single bit
Take a good look at your Photos folder. See all your family snaps and short videos? Wouldn't it be a shame if your drive were to fail and everything were lost? This is why you must back up important data, your operating systems, and other files you'd rather not risk to hardware failure (or ransomware). But it may not even need to come to that, as photos, documents, or other file types could become corrupted or accidentally deleted.
Unless you have success using a data recovery service, that data is lost forever. Backups are vital in protecting your data against accidental deletion, drive failure, or other scenarios outside of your control. In the world of cloud computing, more of our data is stored on servers owned by third parties. The 3-2-1 backup rule ensures you have three copies on two devices, with one located off-site. By creating and storing copies of your data, you are protecting yourself against loss and even ransomware.
Not only should you back up data to multiple storage devices, but it's recommended to store data in different locations. Cloud storage platforms can count as one location, another being your home. Automated backups take these measures to a whole new level, taking all the manual input out of the equation. By using a combination of network features and short scripts, we can make it so our devices can be backed up even when away from home.
How to follow the 3-2-1 backup rule for NAS and protect your data
Keep it secret, keep it safe
What is WOL, and how can it help?
Automating the backup process
Wake-on-LAN is an incredible feature that can make it possible for a network packet to boot up a device, such as a PC, without you having to physically press the power button. It works by using the network interface card (NIC) to send a boot command to the motherboard, effectively allowing external devices to turn on the system. It's handy for a variety of tasks and scenarios, one being automated backups.
You may not use your PC every day, or you may forget to run your backup script for a while. Having WOL configured and a scheduled task on a NAS or some other device set to boot up your PC and back everything up can be the difference between losing everything from the last number of days and nothing at all. We can take this one step further and have the network turn on the device, and then another script to shut the PC down once the backup has completed.
4 reasons you might want to set up Wake-on-LAN on your PC
Wake-on-LAN can be a real time-saver.
How I automatically back up everything
WOL + NAS + rsync
You're going to need a few things to get started. We'll need a device that supports WOL, obviously, else this won't work. Most modern PCs should support this feature. A NAS or some other storage medium will also be required to store files. A NAS will need to have a file transfer protocol, such as SMB or NFS, enabled for access. Finally, we'll need a backup method, such as rsync or veeam. Here's a quick and dirty shopping list:
- Devices that support WOL.
- Somewhere to stash your backups. I recommend a NAS.
- Your favorite backup method. I'm using rsync.
- A device to schedule and run automated tasks. Our NAS can do this, or you can use another system.
Before doing anything, we need to ensure WOL is enabled and working on all our client devices. For PCs, this process is rather straightforward and usually involves a single BIOS/UEFI setting change. There's a simple way to verify WOL is working in Linux and Windows. You may also need to configure Windows to allow the NIC to wake up the PC in the networking settings. Once done, we're almost there already.
Next up, we need to compile a MAC and IP address list of all the clients we wish to include in this backup strategy. Give each client a descriptive name, too, so it's easy to reference each client later down the line without having to look up each IP address to work out which device it belongs to. On your NAS, you'll need an SMB or NFS share that can be used for Windows and Linux, or macOS clients. A user with appropriate permissions would be required.
With rsync and veeam configured on each PC, it's time to create a simple script that runs as a cron job. On Windows, PowerShell or scheduled tasks can be used. I'm using a simple .bat file that runs on the last Friday of each month. This takes the MAC and IP address of the device, attempts to send the WOL signal, waits for it to boot up, and runs a local backup script through SSH that copies everything across to the NAS. It then shuts down the PC.
To shut down a Linux PC through SSH, we'd use shutdown -h now, and for Windows, it would be shutdown /s /t 0. This is why it's vital we have Linux, macOS, or Windows configured correctly for the script to run successfully. If SSH isn't enabled or allowed for the script to run, you could end up booting up your system and leaving it there without backing anything up. Thankfully, it's easy to manually run the scripts before setting up scheduled tasks.
Worried about ransomware? Configure automated backups for peace of mind
Take some weight off your shoulders by automating your backup tasks
