Configure your Backup / Recovery: External Hard Drives

Configure your Backup / Recovery: External Hard Drives
Page content

Backup Vs. Disaster Recovery

Your data is only as good as your most recent backup, and your ability to restore and access it in a reasonable amount of time. If you don’t have a solid backup plan in addition to a disaster recovery solution, then your bases are not all covered.

A backup is your insurance against losing serious time in the event that you lose, save over, or delete the wrong file, or someone changes their mind, and you need to go back to a several day old version of the file you’ve been working on.

You also need a disaster recovery plan in case the building burns down, or your backup is otherwise rendered unavailable. There are things like fireproof safes in which backup media can be stored, but getting to the safe isn’t always convenient, especially if it’s covered in rubble or in an area that’s been taped off by safety officials as they clean up after a fire or other such catastrophe.

Tape Vs. Hard Drive

Backup tapes were the media of choice for backing up large amounts of data for years, and they’re still common today. Tapes offer a large amount of data storage in a relatively compact piece of hardware.

However, there are drawbacks that may make tape undesirable, such as the inherent volatility of the media. Magnetic fields from nearby electronics, from the tape drive itself, and indeed even from the earth will take a toll on the tapes, and will contribute to data corruption.

Another problem with tape is that if the server or tape drive dies or is no longer accessible, you’re going to need another server, with the same sort of tape drive and software to read your tape. You may be able to find companies that offer restoration services, but this can be a costly and slow process.

Tapes and tape drives are also very susceptible to damage from dust and require regular cleaning. It’s very easy to over-clean a tape drive too, which can cause damage to the reading heads.

External hard drives are also susceptible to the same magnetic forces, but are usually more resilient than tape media. Drives with backup data can be easily transferred to a new server. If the server is of the same file system as the original, accessing the data on the drive wont take much effort.

External drives are constructed in such a way that dust should not be a problem, and they do not require cleaning.

If the tape limitations listed above are a concern for your backup or recovery, an external hard drive may be the answer.

Third Party Backup Software VS. Simple Scheduled Batch File

For most software that was designed to use tapes for backup and recovery, external hard drives can be used with a little additional configuration. Although this is a suitable solution, you’ll need to have access to the same software in order to read the backups. Each backup software, like Symantec’s Backup Exec or Windows Backup will save all data in a compressed file that you will need to be able to read.

If you don’t need the compression that a third-party backup program gives, a backup solution utilizing a simple batch file with either a Robocopy or Xcopy script is perhaps the most convenient scenario for performing a restore.

Example of Simple Windows Xcopy Script Backup

Xcopy is a powerful tool for duplicating data, and it is included natively in Windows.

To set up an Xcopy script to handle a simple backup, follow these steps:

1. Connect your external hard drive, and make a note of the drive letter it is assigned by Windows (the rest of this example will assume the external drive was given the R:\ letter designation).

2. Open notepad, by going to Start, Run, and type “Notepad.exe” and click ok.

3. In notepad, type the following: xcopy [the folder you want to back up] [folder on the external drive you want to copy to] and then add the relevant switches. For example:

xcopy E:\data\files\*.* R:\backup\files\ /c/d/e/h/y/i

4. Save the file, and rename it from .txt to .bat.

5. Use Windows Scheduled Tasks to run the batch file on a schedule.

This script will make an exact copy of the original folder on the external drive. To restore a file, you simply browse to its location in the backup folder, and copy it wherever you like.

Remember, if there’s a space in the path, you need to put quotation marks around the path. For example: xcopy “E:\data\New Files\*.*” “R:\backup\new files”.

In the example above, the switches are as follows:

  • /c - tells xcopy to continue the process if there’s an error copying a file.
  • /d - tells xcopy to copy only files that are newer than the same files in the destination.
  • /e - tells xcopy to copy directories and sub-directories, even if they’re empty (remember: “e for everything”).
  • /h - tells xcopy to copy hidden files.
  • /y - tells xcopy not to ask you to confirm each file.
  • /i - tells xcopy that if the destination does not exist already, and you’re copying multiple files, assume the destination is a directory.

For more information on what the different switches do, click here.

Limitations to Xcopy:

  • Xcopy will not copy any files that have more than 254 characters in their file path.
  • Files that are removed from the live data are not removed from the backup, so the data has to be removed from time to time.
  • There is no data compression like there is with programs like Backup Exec.
  • Cannot make copies of open files.

Example of Simple Windows Robocopy Script Backup

Robocopy is more robust (hence “robo”) than Xcopy, and doesn’t have the 254 character limit that Xcopy has.

To use Robocopy to handle the same backup job as above, follow these steps:

1. Connect your external hard drive, and make a note of the drive letter it is assigned by Windows.

2. Open notepad, by going to Start, Run, and type “Notepad.exe” and click ok.

3. In notepad, type the following: robocopy [the folder you want to back up] [folder on the external drive you want to copy to] and then add the relevant switches. For example:

robocopy E:\data\files\ R:\backup\files\ /mir /r:2 /w:2

4. Save the file, and rename it from .txt to .bat.

5. Use Windows Scheduled Tasks to run the batch file on a schedule.

The switches in this case are as follows:

  • /mir - Makes a mirror copy, which means if a file has been deleted from the source, it will be purged from the backup drive.
  • /r:2 - This tells Robocopy how many times to retry copying a file if it’s not able to copy it on the first attempt. In this instance, it will try twice.
  • /w:2 - This tells Robocopy how long to wait between retry attempts. In this case, it will wait 2 seconds between copy attempts.

Robocopy has many more switches and capabilities than Xcopy, including enhanced logging options, bandwidth throttling, and even has a GUI interface available. For more information on what the different switches do, click here.

Limitations of Robocopy:

  • Not available by default in all versions of Windows. Prior to Windows Vista and Windows Server 2008, Robocopy had to be installed as part of a Windows resource kit.
  • Like Xcopy, Robocopy cannot make copies of open files.

Multiple Day Backups

You could use either of the two script solutions above to create multiple backups on the same hard drive. If you have the space on the drive to include five copies of your data, you could configure multiple batch files, and multiple scheduled tasks.

With xcopy, the scripts would look like:

xcopy E:\data\files R:\backup\Monday\files\ /c/d/e/h/y/i

Create a new Xcopy, and change Monday to Tuesday, etc. This will allow you to go back as far as six days ago.

That same thing can be done with Robocopy thusly:

robocopy E:\data\files R:\backup\Monday\files /mir /r:2 /w:2

If you buy yourself two external hard drives, you can switch them out once a week, and take one offsite with you as a disaster recovery plan. If the building burns down, you’ll still have your data, even if you lose a week’s worth of changes.

References

  • All information in this article is from the author’s own experience.
  • The web-comic “Stick I.T.” is written and drawn by Matt Conlon.