backup scheme using cdrtools

  • Thread starter =?ISO-8859-1?Q?=BBQ=AB?=
  • Start date
?

=?ISO-8859-1?Q?=BBQ=AB?=

After a bit of data loss due to not backing up important files to
CDR often enough (because I forget), I decided to do what I could to
automate things. I have two HDDs, and what I settled on was to make
incremental backups to the second HDD automatically and to put a
link on the desktop for burning to CD. I grabbed some free
command-line tools and wrote a couple of cmd.exe scripts, and I
thought I might as well type up what I've done in case anyone finds
it useful. My scheme couldn't be used by someone else without
modification; I'd recommend completely rewriting the example
script down below. Also, the burning script requires a bit of input
from the user, and it makes no attempt to check that the input is
not garbage. (The burning app does do some media checks of its own,
but I have not bothered to test it much for that.)

I'm running WinXP home. Tools I am using:

nnCron Lite
<http://www.nncron.ru/>

zip, from the Info-Zip project
<http://www.info-zip.org/pub/infozip/>

mkisofs and cdrecord, both from the Win32 cdrtools
<ftp://ftp.berlios.de/pub/cdrecord/alpha/win32/cdrtools-1.11a12-win32-bin.zip>

zip.exe, cygwin1.dll, mkisofs.exe, and cdrecord.exe all need to be
in the system path. I have them in the system32 directory.

I do more than this, but I'll just describe how I handle backing up
"My Documents". I keep that directory relatively small, so it fits
on a CD once zipped. Excluding files from the backup or spanning
disks is possible, but I have no details as I don't need to do that.

The partition for backup files on the second HDD is Y:\. I have
the following entry in cron.tab.

# Refresh zip archive of My Docs every 30 min
@*/30 * * * * zip -urS9 Y:\MyDocsBak "C:\path\My Documents\*"

This adds any new or modified files from My Docs. It does not
remove any files that have been deleted from My Docs, so there are
still backups of old files. Once I burn to CD, I start with a fresh
zipfile on the HDD. Cron is set to run everything in the
background, and I find I never notice the zips being updated except
when creating brand new ones; I barely notice it then.

A few notes about the burning script, then I'll just paste it and
quit typing.

1. I am not terribly proud of the script; it's not neat, but it
does what I need. I'm not posting it as a template, only FYI.
2. It is for cmd.exe, not command.com, and I don't know what
modifications would be necessary to make it work with command.com.
3. dev=1,0,0 is my cd burner. Running 'cdrecord -scanbus' will find
the available devices. ATAPI burners can be used only if an ASPI
layer is installed (at least with the version of cdrecord I
linked to above).
4. My write speeds are 4x and 32x for CDRWs and CDRs.
5. I don't recall what all the switches do. That info is in the man
pages, easy to google for.
6. The cdrtools use forward slashes for paths.

-----burnmydocbak.cmd-----

@echo off
cls

REM use forward slashes in the path to filetoburn
set filetoburn=Y:/MyDocsBak.zip

color 0b

REM prompt for medium

title Backup MyDocs - Insert Disk to Burn

echo.
echo It's time to burn a backup of your documents
echo to a CD-RW or CD-R. Put a disk into the drive
echo then tell me which kind you inserted.
echo.
echo Enter '1' if it's a CD-RW
echo '2' if it's a CD-R
echo anything else if you want to quit without writing
echo.

set /p medium="# "

if %medium%==1 goto makeiso
if %medium%==2 goto makeiso
goto end

:makeiso

cls
color 0a

title Backup MyDocs - Creating ISO Image

echo.

REM make the iso
REM the '-V MyDocsBak' sets the volume label
REM -o gives the output destination

mkisofs -V MyDocsBak -l -v -J -r -o C:/temp/doctemp.iso %filetoburn%

if %medium%==2 goto burncdr

:burncdrw

color 0c
cls
title Backup MyDocs - Blanking the CD-RW

cdrecord dev=1,0,0 speed=4 blank=fast

cls
title Backup MyDocs - Burning the CD-RW

cdrecord -v -dao -eject dev=1,0,0 speed=4 C:/temp/doctemp.iso

goto eject

:burncdrw

color 0e
cls

title Backup MyDocs - Burning the CD-R

cdrecord -v -dao -eject dev=1,0,0 speed=32 C:/temp/doctemp.iso

:eject

color 0b

title Backup MyDocs - Remove the Disk

echo.
echo We're finished backing up your documents.
echo Remove the CD and put it somewhere safe.
echo.
pause

title Backup MyDocs - Deleting the ISO Image and the Old Zip

del C:\temp\doctemp.iso
del Y:\MyDocsBak.zip

:end
 
V

vince

cdrecord -v -dao -eject dev=1,0,0 speed=4 C:/temp/doctemp.iso
cdrecord -v -dao -eject dev=1,0,0 speed=32 C:/temp/doctemp.iso

Does your burner do burnproof?
driveropts=burnproof

Might want to include -pad option.

A step you might add is to verify the files on CD are the same as the
files on the hard drive. md5sum works well for this.
md5sum -b discfiles >>bu.compare.txt
md5sum -b CDfiles >>bu.compare.txt
type bu.compare.txt
 
?

=?ISO-8859-1?Q?=BBQ=AB?=

Does your burner do burnproof?
driveropts=burnproof

That's a good suggestion, but my burner supports JustLink instead of
Burnproof. JustLink is not an option with the version of cdrecord I
have, AFAICT. (Looks like newer versions of cdrecord use
driveropts=burnfree, which covers serveral types of underrun
protection, including JustLink.)
Might want to include -pad option.

Thanks. Can't hurt and might help; I'll add it.
A step you might add is to verify the files on CD are the same as
the files on the hard drive. md5sum works well for this.
md5sum -b discfiles >>bu.compare.txt
md5sum -b CDfiles >>bu.compare.txt
type bu.compare.txt

That's a very good idea. I'll add it when I get a little time to
download md5sum.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top