Re: Maintain backup directory
- From: "Tom Tyson" <no@xxxxxxxx>
- Date: Thu, 28 Aug 2008 13:17:57 +0200
Pegasus,
thanks so far. When I run the script (after setting target to the right
location and removing line numbers), the script wants to "echo delete" a
configuration file (backupplace.cfg) that resides inside the directory. I
assume the script goes for it because its the oldest file out there. Can you
modify the script to only handle files with the .tib extension?
Tom
"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message
news:OtRxQjoBJHA.4884@xxxxxxxxxxxxxxxxxxxxxxx
"Tom Tyson" <no@xxxxxxxx> wrote in message
news:g8sh1k$9l2$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi folks,
I am currently running XP SP3 and use TrueImage 10 to run a scheduled
task (nightly) to perform a differental backup of my primary HD onto an
external USB HD. TrueImage allows for setting both pre- and post-job
commands. I use the post-job command to shutdown my system via
'shutdown -s' (energy is expensive here in Europe, too ;)
The initial image is about 80-90 gb, the differental backups are created
at about 15 gb each daily. Consequently, the backup media runs out of
disk space after a while. In this case, TrueImage fails to do the job.
My idea was to use a pre-job script to look at the backup directory and
make sure there is sufficient space for the pending job to complete.
Looking at the growth rate of past jobs, I would consider 1.5 times the
size of the latest differental job (by date) as a good measure. Example:
Backup Dir with:
backup.tib => 80GB
backup1.tib => 13GB (dated: 8/8/08)
backup2.tib => 14GB (dated: 8/9/08)
backup3.tib => 16GB (dated: 8/10/08)
backup4.tib => 18GB (dated: 8/11/08)
In this case, I would want the script to clean up 27 GB of space, which
would mean delete backup1 and backup2 before the backup process starts.
The script may neither delete the master backup (backup.tib) nor the
latest differental file (backup4). If these constraints do not allow for
further execution of the script, I think I should be informed and
manually move the contents of the backup drive to a safe location, delete
all and start over with a fresh master backup. This could also be done by
script if a 2nd backup device was present. So be aware of my next post ;)
Some of you might have noticed that I'm fairly new to backup strategies
:) Be aware that I'm only trying to maintain my home office, so I'm not
hurting anyone!
Thanks in advance for your input,
Tom
Below is a batch file answer to your question. Here is how to apply it:
- Adjust Lines #2-4 to suit your requirements. Line #4 gives your
growth margin (150 stands for 150%, or 1.5).
- Unwrap any lines that your newsreader might have wrapped.
- Remove the line numbers.
- Run the batch file and watch what happens. It won't delete any files!
- Remove the word "echo" from Line #18 to enable the file deletion.
- When you're happy with the result, remove Line #19.
01. @echo off
02. set Target=d:\My Backups
03. set FullName=backup.tib
04. set Factor=150
05.
06. for /F %%a in ('dir /b /od "%Target%"') do set Newest=%%a
07. for %%a in ("%Target%\%Newest%") do set NSize=%%~za
08. set NSize=%NSize:~0,-6%
09.
10. :Again
11. for /F "tokens=3" %%a in ('dir /-C "%Target%" ^| find /i "bytes
free"') do set Free=%%a
12. set Free=%Free:~0,-6%
13. set /a Needed=%NSize% * %Factor% / 100
14.
15. if %Needed% LSS %Free% goto :eof
16. for /F "delims=" %%a in ('dir /b /o-d "%Target%"') do if /i not
"%%a"=="%FullName%" set Oldest=%%a
17. if /i "%Oldest%"=="%Newest%" goto Notify
18. echo del "%Target%\%Oldest%"
19. pause
20. goto Again
21.
22. :Notify
23. blat.exe /.. /.. /..
24. rem blat.exe is a downloadable command line mailer
.
- Follow-Ups:
- Re: Maintain backup directory
- From: Pegasus \(MVP\)
- Re: Maintain backup directory
- References:
- Maintain backup directory
- From: Tom Tyson
- Re: Maintain backup directory
- From: Pegasus \(MVP\)
- Maintain backup directory
- Prev by Date: Re: Permissions different for WshShell and .exe in Server 20003 SP1 and SP2 ?
- Next by Date: Re: Maintain backup directory
- Previous by thread: Re: Maintain backup directory
- Next by thread: Re: Maintain backup directory
- Index(es):
Relevant Pages
|
Loading