Friday, April 20, 2007

Backup files using your existing compression software

Usually, with time, the cost of data becomes much more then that of the hardware itself!
Almost every computer user, at one time or the other, requires a backup plan for his precious data.

Now, with WinRAR(http://www.rarlab.com), one can no longer make an excuse of the high costs and unavailability of professional backup solutions. Agreed that WinRAR is a compression program which is replacing ZIP and the like, due to the enhanced features it provides, but with the great flexibility offered by WinRAR common line syntax, one can easily mould WinRAR in a complete backup solution!
You may already have WinRAR on your hard disk, so why not start using it for your backups?

Note1: You do not need to rename the backup files to remember when it was made. A WinRAR switch, which I utilized, automatically prepends the current date to the archive name. So you can make backups daily, without the need of manually renaming files!

Note2: You may need to change the location of your data files to be backup, for which usually you will need to open up the shortcut, batch file etc. This will have the risk of accidentally deleting/modifying some switch in the long list of switched used. To combat this, a simple text file is used, which contains the base path to be backup.
Just open the text file and alter the file to your needs!
What's more, you can add more backup source paths, one line at a time! (but remember to remove the ‘-ep1’ switch before adding more than one paths)

p.s.: Did you know that using WinRAR your backup file size can be as big as a whooping 8,589 billion gigabytes in size!?!

We would see now how to perform three types of backup operations:
  • Full Backup
  • Incremental Backup
  • Differential Backup

Full Backup

Intro: This is a backup of ALL the existing files in source folder.
Comment: This backup may be done once a while to get a complete snapshot of all the file at that moment.
Restoration: To restore a file, files can be directly retrieved from this archive (if no newer backup exists)

Command line:

winrar.exe a -se -rr3p -ac -ag+YYYYMMDD_full_ -k -m5 -ms -os -r -ep1 e:\mydoc.rar @mydocpath.txt

Command/switches used with purpose:



command/switch Purpose Used
a add files to archive
-se solid archive based on file extensions - not recommended due to data loss risk on low quality media
-ac clear archive attribute after archival
-ag+YYYYMMDD_ add current date in archive name
-k protect archive from tamper or accidental modification
-m5 use best compression (also slowest)
-ms Do not waste time in re-compressing compressed files such as ace, arj, bz2, cab, gz, jpeg, jpg, lha, lzh, mp3, rar, zip, taz, tgz, z
-os keep NTFS streams (recommended if your files are stored on NTFS)
-r recurs subfolders
-ep1 strip base folder name
-rr3p recovery record is 3% (alter as per the reliability of your media). 'p' stands for percent

Incremental Backup

Intro: Takes backup of the files modified since the last backup.
Comment: Takes very less time as only a small number of files are usually changed daily. These are the files backup up by this method.
Restoration: To restore a file, you need to first retrieve the last FULL backup, then ALL the incremental backups up to the date required in chronologically dated order, starting from the oldest to the latest.

Command Line:
winrar.exe a -se -rr3p -ac -ag+YYYYMMDD_incr_ -k -m4 -ms -os -r -ep1 -ac -ao e:\mydoc.rar @mydocpath.txt

Command/switches used with purpose:

command/switch Purpose Used
All from the FULL backup As tabulate above
-ao add only the files with archive bit on
-m4 Replaced -m5 with -m4 for faster daily backups
REMOVE -m5 Replaced -m5 with -m4 for faster daily backups


Differential Backup

Intro: Takes backup of all files since the last FULL backup.
Comment: Takes more time to backup with time. This is because this backup backups up all files modified since the last FULL backup.
Restoration: To restore a file, retrieve the last FULL backup, and then the latest differential backup file.

Command Line:
winrar.exe a -se -rr3p -ag+YYYYMMDD_diff_ -k -m4 -ms -os -r -ep1 -ao e:\mydoc.rar @mydocpath.txt

Command/switches used with purpose:

command/switch Purpose Used
All from the FULL backup As tabulate above
-ao add only the files with archive bit on
REMOVE -ac to prevent the archive bit from changing due to backup
-m4 Replaced -m5 with -m4 for faster daily backups
REMOVE -m5 Replaced -m5 with -m4 for faster daily backups


Hopefully this will keep your data living 'Happily Ever After' :)
Comments/suggestions/improvements are welcome.

2 comments:

Anonymous said...

switch -rr3% shold be -rr3

waveking said...

Thanks for the tip-off. I think over the years Winrar changed this command. I'll update the post.