D(one) IT

IT Tips, Tricks & Such


Using Veeam Backup and Replication, I found that this size of the backup file can be greatly reduced if you use Sdelete to zero out the free space in the VMs being backed up (Fixed Disk).

I use a script from Yellow Bricks, which defrags all local drives then runs sdelete to zero out free space. I usually run this script after major program installs, Drive increase or on a quarterly bases.


@echo off
cscript c:\sdfrag.vbs


 Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso, d, dc
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
WshShell.RegWrite "HKCU\Software\Sysinternals\", 0, "REG_SZ"
WshShell.RegWrite "HKCU\Software\Sysinternals\SDelete\", 0, "REG_SZ"
WshShell.RegWrite "HKCU\Software\Sysinternals\SDelete\EulaAccepted", 1, "REG_DWORD"
For Each d in dc
If d.DriveType = 2 Then
Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)'
Return = WshShell.Run("sdelete -c " & d, 1, TRUE)
End If
Set WshShell = Nothing 


One response to “Sdelete

  1. Matt October 9, 2012 at 8:47 am

    You probably want to change this to the -z option for sdelete since newer versions use that to write zeros. If you use -c it will just fill the unused space with random data and expand the disks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: