Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a series of scripts setup to backup my Exchange. The following command is executed to start the process:

diskshadow /s C:\Backup_Scripts\exchangeserverbackupscript1.dsh

This is exchangeserverbackupscript1.dsh:

#DiskShadow script file

set verbose on
#delete shadows all
set context persistent
writer verify {76fe1ac4-15f7-4bcd-987e-8e1acb462fb7}
set metadata C:\Backup_Scripts\shadowmetadata.cab
begin backup
add volume C: alias SH1

create

expose %SH1% P:
exec C:\Backup_Scripts\exchangeserverbackupscript1.cmd
end backup
delete shadows exposed P:
exit
#End of script

And this is exchangeserverbackupscript1.cmd:

robocopy "P:\Program Files\Microsoft\Exchange Server\Mailbox\First Storage Group" "\\leahyfs\J$\E-Mail Backups\Day 1" /MIR /R:0 /W:0 /COPY:DT /B

This is not causing Exchange to purge its log files. The edb file is 4.7 gigabytes, but the First Storage Group folder itself is 50+ gigabytes due to many, many log files for each day going back to 2009.

Is there any way -- I've Googled and haven't found anything -- to notify Exchange when I've completed a full backup, and have it purge its log files?

According to this and this, end backup should cause Exchange to "flush the transaction logs for that storage group" but only "if a successful backup of a storage group occurred", which leaves my question as:

What constitutes a "successful backup", and why is what I'm doing not it?

share|improve this question
    
Check your event logs for events from category Exchange VSS Writer and see what those say. Also, is LCR/CCR enabled on that Exchange server? –  Wesley Apr 17 '12 at 20:56
    
LCR/CCR is not enabled. At the time that my backups run -- 6AM -- I see that it "prepare[s] for backup successfully", "fr[eezes] the storage group(s) successfully", "successfully prepare[s] for a full or copy backup", "prepare[s] for Snapshot successfully", "thaw[s] the storage group(s) successfully", and then "processe[s] the post-snapshot event successfully" all this within 10 seconds -- from 06:00:03 to 06:00:13 -- and then ~8 minutes later it "processe[s] the backup shutdown event successfully", and then isn't seen 'till the next backup. –  Robert Allan Hennigan Leahy Apr 17 '12 at 21:14
    
Is the database on a drive / LUN that has some form of hardware support for log truncation? For example, a NetApp appliance. –  Wesley Apr 17 '12 at 21:39
    
It's on the same 640 gig SATA drive that Exchange and the OS are installed on. This was a bare minimum cost setup. –  Robert Allan Hennigan Leahy Apr 17 '12 at 22:01

1 Answer 1

up vote 5 down vote accepted

In general, the BEGIN BACKUP / END BACKUP block would signal Exchange to truncate the logs. But in order for it to work, you should have created a snapshot of all volumes with Exchange-related data - so if you have separated data and transaction logs, you would need to snapshot both - the data and the Tlog volume.

Also, you should make sure that your script exchangeserverbackupscript1.cmd really returns with an exit code of zero - if it does not the diskshadow script would abort and the "end backup" line would never get executed. I believe robocopy would exit with the exit code of "1" upon successful file copy which might present the root of your problem as the errorlevel of robocopy would be the errorlevel of your batch if the robocopy is the last executed command. Try adding a conditional checking for robocopy's success and an exit /B 0 to the end of your batch file.

share|improve this answer
1  
Exactly. I was thinking "But how do we know end backup is successfully exiting?" –  Wesley Apr 17 '12 at 22:03
    
You are my favourite person right now. Watching 2.5 years of log files (~45 gigs) just drain away was magical... –  Robert Allan Hennigan Leahy Apr 17 '12 at 22:07
1  
@RobertAllanHenniganLeahy glad to read that. Cheers –  the-wabbit Apr 17 '12 at 22:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.