2

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.

NotMe
  • 3,772
  • 7
  • 31
  • 43
  • 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. – NotMe 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

2 Answers2

2

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

Sean Earp
  • 7,227
  • 3
  • 36
  • 38
0

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

John Rennie
  • 7,776
  • 1
  • 23
  • 35