Quantcast
Channel: Admins Goodies » vss
Viewing all articles
Browse latest Browse all 10

Exchange DiskShadow/Robocopy backup does not purge log files

$
0
0

Question

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 fileset 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 SH1createexpose %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?

Answer

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.

Answered by syneticon-dj

Viewing all articles
Browse latest Browse all 10

Trending Articles