In this article I will show you how to make your own backup software without downloading any tools. There is a lot of free and paid software for backup that you can use. One of them is Immortal files for both Windows and Mac. But if you don’t want to use any of it, here is how you can do it yourself.
Backup is an extra copy of your files and systems. It’s always best to store your backup externally. This will minimize your risk of losing everything if something happens to your computer. But sometimes it’s more convenient to store things locally as well. Internal storage can be beneficial if you are making a lot of small changes and it won’t hurt you much losing it. There are many ways to make a local copy of your files: copy and paste everything manually, using a backup and restore functionality in Windows, local repositories like SVN, GIT or Mercurial and many others.
Latest versions of Windows come with great tools to take your backups. An example is “Backup and Restore” utility where you set everything up by clicking some buttons. Next I will talk about how to make it yourself.
The easiest way to backup your files in Windows is by making a local backup executable .bat file and using a command
robocopy (or xcopy for Windows XP). Robocopy command is a standard feature in Windows starting from Windows Vista.
ROBOCOPY Source_folder Destination_folder [files_to_copy] [options]
@echo off robocopy c:myfiles d: /e /eta exit
There are a lot of things to remember to do these days. So you will need to set up your backups to run automatically. After you have created a backup.bat file you need to set it up to run automatically. There are several ways to do it:
This is an easy way to do it if you start your system often. I don’t shut it down for several months in a row, so this method is not suitable for everybody.
Linux is a very powerful system. It’s built to make things mostly with commands. This is also the most reliable way to take your system backups.
On Unix systems the easiest command line is rsync.
rsync option source-directory destination-directory
Here is a simple example that will create a directory “mydata” inside “mybackup” and copy everything there:
rsync -vax /hdd1/mydata /hdd1/mybackup
A good thing about external hard drives is that you mount them into your system. The following example command with rsync for Linux will create the directory “mydata” on the second hard drive and copy it to the destination:
rsync -vax /hdd1/mydata /hdd2/
Somewhat complex, but very good option is to use the btrfs filesystem with snapshots on Linux.
System snapshot is a copy of your system at the time the snapshot is taken. It’s similar to system images in Windows.
In order to backup your file automatically in Linux you will need to set up a cron job. In Linux it’s easy to do it with crontab. Crontab is a command that created a cron table file that contains commands and instructions for the cron daemon to execute. Depending on your Linux installation, you may need to get a crontab on your system.
syntax of crontab command:
minute(s) hour(s) day(s) month(s) weekday(s) command(s)
Here is an example of making a backup every day at 23:30. Command with these options will also delete files that you have deleted from mydata:
30 23 * * * rsync -vax --delete /hdd1/mydata /hdd2/
Example execute a cron job (WordPress wp-cron.php ) every 10 minutes:
*/10 * * * * /usr/bin/php -f ~/webroot/crontab.php
Crontab.php is a file we wrote in order to call WordPress wp-cron when we want. Per default WordPress wp-cron runs each time a user visits your website.
You should store your data somewhere in addition to your primary system. It can be a Cloud storage, external servers, hard drives under your table or another PC/tablet/phone. No matter what you choose – make at least one external backup.
This rule can be summarized as the 321-rule. Keep at least 3 copies, in two different formats and 1 of those copies off site.