Veeam: Change the Veeam Storage Optimization with Powershell


In Veeam Backup and Replication you can choose three different types of Storage optimization.

image

See the blog post on the Veeam website for more info: http://www.veeam.com/blog

From @gostev I received the following tip:

Note that storage optimization will not take effect until next full backup. Setting is used for newly created backup storage only.

There is no standard cmdlet to change this settings, so we have to find the property of the Storage optimization settings. With some trial and error I found the stgBlockSize property. This property can be found inside the vbrjob options.

You can view this properties via:

$vbrjob = Get-VBRJob | where {$_.Name -eq "<vbrjobname>"}
$options = $vbrjob.GetOptions()

and via the StgBlockSize property you are able to find the actual value of this setting.

$options.StgBlockSize

I have tried the three options from the screenshot and found the following three values:

    $localtarget = "KbBlockSize1024"
    $lantarget = "KbBlockSize512"
    $wantarget = "KbBlockSize256"

Now we have found the properties we need to change the settings via PowerShell. We can build some scripts.

If you want to change the Storage option to LAN target on all your backup jobs. You can run the following script on your Veeam Backup and Replication server. Don’t forget to change the StgBlockSize value with the variable you want to use.

if((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null){
    Add-PSSnapin "VeeamPSSnapIn"
}

$vbrjobs = Get-VBRJob 

foreach($vbrjob in $vbrjobs){

    #Storage optimization 
    $localtarget = "KbBlockSize1024"
    $lantarget = "KbBlockSize512"
    $wantarget = "KbBlockSize256"

    #Change Job Options
    $options = $vbrjob.GetOptions()
    $options.StgBlockSize = $lantarget

    $vbrjob.SetOptions($options)
}

Or if you want to change just a couple of your jobs, you can use the following script:

if((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null){
    Add-PSSnapin "VeeamPSSnapIn"
}

$vbrjobs = "<Job1>","<Job2>"

foreach($vbrjobname in $vbrjobs){

    #Storage optimization 
    $localtarget = "KbBlockSize1024"
    $lantarget = "KbBlockSize512"
    $wantarget = "KbBlockSize256"

    #Change Job Options
    $vbrjob = Get-VBRJob  | where {$_.Name -eq $vbrjobname} 
    $options = $vbrjob.GetOptions()
    $options.StgBlockSize = $lantarget

    $vbrjob.SetOptions($options)
}

So with the Powershell toolkit for Veeam you can perform every change you want and can do via the GUI. You can expect some more posts about automating Veeam Backup and Replication with Powershell.

Advertisements

One thought on “Veeam: Change the Veeam Storage Optimization with Powershell

  1. Rick Vanover

    Great post!

    Just a note – that the different KbBlockSize values will specify the block size of the source deduplication. Source deduplication meaning, determine deduplicated blocks of a VMDK before it is transferred to optimize backup window. The WAN target is optimized to transfer less over a (presumed) slower network setting by using a smaller KbBlockSize value – yet incurring more CPU overhead on the source deduplication. The converse is to leverage the (presumed) fast transfer/throughput of the local disk target with a higher block deduplication size, and less CPU overhead.

    In all, each option is a tweak to optimize the job so that the backup window is shortened.

    See this blog post also: http://www.veeam.com/blog/advanced-storage-option-to-configure-source-deduplication.html

    Disclosure: I work for Veeam Software.

    Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s