Automated backup drive housekeeping for TrueImage (or other) software

W

Will Dormann

One of the things that TrueImage is currently lacking is some sort of
automated "housekeeping" routine for the created images. For example,
let's say you have a scheduled incremental backup that runs once a week
and creates images on your D: drive. Well, unless you keep up with
deleting old images, the drive is eventually going to fill up and
TrueImage will come back and report that the destination drive is full.

The scheduled backups are great, but to make the backup routine totally
hands-free I made a quick and dirty modification to a disk space
notification VBS file. This script will check the free space available
on the D: drive. If it's less than 1GB, it will remove *.TIB files
from that drive.

It's not as sophisticated as deleting only the oldest backup images as
necessary, but it gets the job done. And TrueImage is smart enough
that if there is no full backup present (such as the case when this VBS
clears the drive of your backups when it is nearly full) when your
scheduled Incremental backup runs, it will create a full backup instead.
i.e., your one scheduled incremental backup will take care of both
full and incremental backups, depending on the presence of existing .TIB
files. Just have this .VBS file run a minute or so before your
TrueImage backup is scheduled to run. Incremental backups will
continue to accumulate on the backup drive until it reaches the
specified capacity. At which point it will delete the backups and start
fresh again.

It should also work for other backup software and not just TrueImage.

-WD

Here it is:

' Sample code for monitoring windows disk space
'
'

set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives

for each oDrive in oDrives
Select case oDrive.DriveLetter
Case "D"
'msgbox oDrive.FreeSpace & vbcrlf
if oDrive.FreeSpace < 1000000000 then ' Less than 1 GB free...
'msgbox "Cleanup Time!"
oFs.DeleteFile("D:\*.tib"),DeleteReadOnly
else
'msgbox "You've got enough space"
end if
End Select
next
 
P

Paul Atreides

[cut]
It should also work for other backup software and not just TrueImage.
[cut]

Nice.

I use a simple system that keeps only the last n versions of a backup.

For exemple, you name your image files BCKIMG#1.SNA, BCKIMG#2.SNA and
BCKIMG#3.SNA (with 3 versions in this case). When the backup batch file
has been ran 3 times, the 3 versions are present on disk. The next
backup will name the next file BCKIMG#1.SNA because it's the oldest.

It's written in standard "CMD" language and works on NT4 and W2K.

The following has be be included in a batch file and called with the
expected file mask. It will return the current file name in the variable
"LatestFileName".

Example:

call :GetLatestFileName \\BACKUPSERVER\BAKHD2\SERVER1\C\BCKIMG#?.SN*


:GetLatestFileName
set LatestFileName=
set NewVersionNumber=
for /f %%v in ('dir %1 /b /o-d') do if not defined LatestFileName set
LatestFileName=%%~nv
if defined LatestFileName for /f "delims=# tokens=2" %%v in ('echo %
LatestFileName%') do set /a NewVersionNumber=%%v %% 3
set /a NewVersionNumber=NewVersionNumber + 1
goto :eof
 
W

Will Dormann

Paul said:
[cut]
It should also work for other backup software and not just TrueImage.

[cut]

Nice.

I use a simple system that keeps only the last n versions of a backup.


That's cool. The only reason I didn't pursue a scheme like that is
that it would break the integrity of the backups in the case of
TrueImage (or probably other) *incremental* backups.

For example, say you have a month's worth of weekly backups:
1 2 3 4
[Full] [Inc.] [Inc.] [Inc.]

And the cleanup script deletes the oldest:
2 3 4
[Inc.] [Inc.] [Inc.]

At this point, backups 2, 3, and 4 are now inaccessible because they all
refer to the original Full backup which no longer exists. When the next
scheduled incremental backup runs TrueImage will create a full backup,
but the previous 3 backup images will be useless and just taking up space.

But in the case of using full backups every time, I think that script
should work just fine.


-WD
 

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