IGF1
Stex Toys

Tag: backup

A huge loss…

by Count Stex on Aug.13, 2008, under Uncategorized

For some time now I’ve been storing all my large data files, photos, downloads and so on on a nice spanned volume of, just shy of, 1TB tucked away inside my girlfriends computer. It was better there than in mine as she doesn’t end up rebooting several times a night from messing around with Windows too much ;)
It is constructed of 4 250GB IDE drives, which used to hum away inside my Netgear SC-101 until I had finally had enough of the driver based implementation they had. Using Windows XP’s built in Dynamic Drives I had them spanned together. This has been working absolutely fine for a good six months.
However, Monday night the gremlins came out and trashed one of the IDE ports on her machine. Somewhat hopefully I simply disconnected the DVD drive, and moved the two ‘lost’ disks over to that channel and waited for Windows to find the drives so I could reactivate the volume. but it wasn’t to be.. the IDE channel had obviously decided in it’s death dance to trash the tables on one of the drives, rendering any hope of a repair hopeless.
Of course this is the risk of running a purely spanned or stripped array.. no safety measure in place to catch the volume when a disk goes, however without picking up some hardware based RAID it’s pretty much the only option you have for a nice simple big old volume. (On Windows at least, a Linux server is in my future I know)
Backup, backup, backup is the cry to make next.. however I had been somewhat lax in this department and found the last full backup I had was September… 2006 .. Fortunately a combination of this and Flickr restored all of our memories in photographic form, so our losses have mainly been less dramatic items, like gaming spreadsheets and course notes.. a pity but nothing we can’t live without.

So.. for the future, having reconstructed the array, a new backup strategy was needed. Now many people would probably go out and buy themselves a backup package, or even just use Windows Backup.. but I wanted something with a little more control. So I hit upon the idea of cannibalising a backup routine I have in work which makes use of the excellent compression tool 7zip and adding on the extra safeguard of a PAR based recovery set.

The two important command lines I’ve come up with are as follows…

For 7zip I have this:
"c:\program files\7-zip\7z.exe" a -r -t7z -mx7 -v640m %backupDir%\backup -i@FilesToBackup.txt -x!recycler

Which basically evokes 7zips command line program 7z.exe and sets it to add files whilst recursing subdirectories to a 7zip format archive set using a compression level of 7 out of 10, and splitting the backup up into CD sized chunks. I may modify this to be DVD sized chunks when the data is back up to it’s original levels. The files to backup are stored in a text file imaginatively called FilesToBackup.txt and it ignores anything that might happen to be in the recycle bin folders that may appear in the location I’m backing up.

The second line which creates the robust PAR set is this:

cd %backupDir%
..\par2 c -r30 backup backup.*

Which moves into the backup folder (I couldn’t get the PAR tool to accept my variable for the backup folder so ended up forcing it into the folder before evoking the command) and creates a set large enough to recover from a 30% data loss from the 7zipped archive. I will be adjusting this level once I know how much I have to off load to CDs to cover the loss of one, or maybe two CDs from the set.

This the full .bat file, which I now have scheduled to run once a week, is as follows..

echo off
set backupDir=%date:~-4,4%%date:~-7,2%%date:~0,2%-%time:~-11,2%%time:~-8,2%%time:~-5,2%
echo.
echo.Creating new backup directory "%backupDir%"
mkdir %backupDir%
echo.
echo Backing up Files
"c:\program files\7-zip\7z.exe" a -r -t7z -mx7 -v640m %backupDir%\backup -i@FilesToBackup.txt -x!recycler
echo.
echo.Creating Recovery Files
cd %backupDir%
..\par2 c -r30 backup backup.*

The initial part is just creating a folder name made up of year-month-day-hour-minute-second to create a fairly unique folder name such as 20080813-182034, although it has a slight bug in this code, which causes the command to fail it the hour in the day is below 10, ie single figures, resulting in two folders being created and all the 7z files being in the root.. and the PAR task just fails completely! I’ll have to review that, although I’m not 100% familiar with how that part works having re-worked something I found online.. somewhere.

Feel free to make use of any of this code if you have a use for it, and if you have any ideas for improvements I’d love to hear them!

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...