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 windows 2008 server which is backing up it's primary drive to a local hard disk.

Because this server doesn't change very often, I only execute it manually when worthwhile changes occur.

So far, I've accrued 13 backups that are on disk. Considering I really only want the last 2; how can I clear those out?

UPDATE: Just to be clear, this question is about the windows server operating system; not SQL server.

share|improve this question
    
How are you backing up? Are you using the native tool, a third party, or some kind of copy utility like robocopy? –  tomjedrz Jun 24 '09 at 17:27
    
I'm using the built in backup utility that ships with Windows Server. –  Chris Lively Jun 24 '09 at 19:02
    
Oh dear God, I'm ignorant. I'm deleting my post that showed clearing out SQL 2008 backups....... Oh please, Friday, get here... –  squillman Jun 24 '09 at 19:16
add comment

2 Answers

up vote 2 down vote accepted

I'm loading up Windows Server Backup on a test server to confirm, but the following post should help:

http://social.technet.microsoft.com/Forums/en-US/windowsbackup/thread/d5302218-91ce-4f02-9fba-9c91e9027f69

For Volume Shadow copy based backups, there is no direct way to set the maximum size for backup with wbadmin. Since Windows Server Backup relies on shadow copies for versioning, you can use the MAX DIFF AREA Size to control how much space is allocated for storing versions.

Moreover, the old backup version will keep growing until all free space is used up, Windows Server Backup will automatically delete the old version backup to make space for newer ones.

You would adjust this threshold here: Volume ->settings -> use limit -> XXX MB

Or, you may also use "vssadmin resize" command line to increase the amount of storage for shadow copies limit.

vssadmin resize shadowstorage /for=<ForVolumeSpec> /on=<OnVolumeSpec> /maxsize=<MaxSizeSpec>

ex. Vssadmin resize shadowstorage /for=F: /on=C: /Maxsize=900MB

share|improve this answer
add comment

Doing it by date is easy from a Powershell script e.g.

$Days = 30
$TargetFolder = "D:\temp"

$Now = Get-Date
$LastWrite = $Now.AddDays(-$Days)
$Files = get-childitem $TargetFolder -include *.bkf | Where {$_.LastWriteTime -le "$LastWrite"}

foreach ($File in $Files)
{ write-host "Deleting File $File" -foregroundcolor "Red";
  Remove-Item $File
}

This deletes all *.bkf files in the folder D:\temp older than 30 days.

With some headscratching you could adapt this to keep only a set number of files. You'd have to sort the output from get-childitem by reverse date and skip the first n files.

JR

share|improve this answer
2  
Server 2008 doesn't use bkf files any more... –  Chris Lively Aug 17 '10 at 1:55
add comment

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.