PowerShell script exchange
Post Reply
Erwin Linker
Service Provider
Posts: 80
Liked: 8 times
Joined: Mar 30, 2016 12:58 pm
Full Name: Erwin Linker
Location: The Netherlands
Contact:

NAS Backup backup size

Post by Erwin Linker »

Hi,

I'am testing with the NAS backup solution for our customers data shares. If possibly i want to have one job with multiple shares for the back-up, but i want to know what the back-up size is per share.

Backup:
- Share 1 \\Company1
- Share 2 \\company2
- Share 3 \\Company3

Can i find the back-up size per share through powershell?
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: NAS Backup backup size

Post by veremin »

This information is not available via PowerShell - you cannot find how much space a certain share occupies in multi-share backup file. Thanks!
Erwin Linker
Service Provider
Posts: 80
Liked: 8 times
Joined: Mar 30, 2016 12:58 pm
Full Name: Erwin Linker
Location: The Netherlands
Contact:

Re: NAS Backup backup size

Post by Erwin Linker »

Hi Vermin,

Is there another way to get the information?
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: NAS Backup backup size

Post by veremin »

No, but can you describe the use case you're trying to solve? May be we can propose some alternative. Thanks!
Erwin Linker
Service Provider
Posts: 80
Liked: 8 times
Joined: Mar 30, 2016 12:58 pm
Full Name: Erwin Linker
Location: The Netherlands
Contact:

Re: NAS Backup backup size

Post by Erwin Linker »

I can try :-)..

We have a multi tenant environment with multiple customers, so we have different customer shares one 1 file server. Some customers want a different retention policy than our default retenion policy of 7 days.

FileServer:
- \\fileserver01\shares\customer1$
- \\fileserver01\shares\customer2$
- \\fileserver01\shares\customer3$
- \\fileserver01\shares\customer4$ (wants a retetion of 31 day's)
- \\fileserver01\shares\customer5$ (wants a retetion of 14 day's and 2 month back-ups)

I thought that the NAS back-up could be a solution for this, and it is. But we want to bill our customers for that back-up data what they are using.
I can create a different job per customer and then read the size of the storage folder on the repository, but if there is a way to combine jobs it would be create.
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: NAS Backup backup size

Post by veremin »

With this type of requirement (bill tenants separately), you will need to have multiple NAS backup jobs indeed. Thanks!
Erwin Linker
Service Provider
Posts: 80
Liked: 8 times
Joined: Mar 30, 2016 12:58 pm
Full Name: Erwin Linker
Location: The Netherlands
Contact:

Re: NAS Backup backup size

Post by Erwin Linker »

Hoi Veremin,

For VB0365 there is a powershell command "Get-VBOUsageData -Organization *" is there a way to implement this also to the VBR powershell? I have a solution for the local back-up data but when i do a offload to a S3 bucket i have the same problem, that i can't find the size off the back-up.

I looks like you guy's have a solution from vbo365?
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: NAS Backup backup size

Post by veremin »

Those products create and store backups differently, so, the feature of one product cannot be easily transported to the other one. But thank you for the feedback; it's been noted.
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

I would be happy just finding out the backup size, and if possible also the read size, for a whole NAS job. I have been digging around the methods and properties, but cannot find it. How is it done?

Clarification: I mean values that corresponds to BackupSize/DataSize of a normal vm backup.
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

Is someone able to provide this information?
sherzig
Veeam Software
Posts: 206
Liked: 46 times
Joined: Dec 05, 2018 2:44 pm
Contact:

Re: NAS Backup backup size

Post by sherzig »

Hi @DanielJ ,

I could adapt one of my existing scripts which measures the job duration. But I am only able to read the amount of data transferred and not the amount of data stored. If this helps, I'll be happy to adapt the script in one of my next commutes.

Cheers,
Steve
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

That would be very helpful, thanks.
sherzig
Veeam Software
Posts: 206
Liked: 46 times
Joined: Dec 05, 2018 2:44 pm
Contact:

Re: NAS Backup backup size

Post by sherzig »

@DanielJ ,

here you are:
https://raw.githubusercontent.com/yetan ... -stats.ps1

You must pass the following parameters:

JobName File backup job name

Depth The number of backups job sessions to be used for the analysis

Cheers,
Steve
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

Thank you, but I'm not sure this works as intended. $transferredAmountBytes gets its value from $processedSize, which is set from $sessDetails.Progress.ProcessedSize. But that number matches the size of the whole source share, not the bytes transferred. I will continue investigating the methods and try to find out something, but it looks like all that is available is the number of transferred files, which is not very useful. What I'm after first and foremost is the size of the NAS backup on disk, and secondly how many bytes were read from source to create that backup. I find it perplexing that this is so difficult (or actually impossible) to find out. It should be very useful for many people who has to report on (and charge by) backed up GB's. In some old thread at this forum I got the understanding that methods for this would be available in v12, but I can't see that they are.

According to @veremin above,
With this type of requirement (bill tenants separately), you will need to have multiple NAS backup jobs indeed. Thanks!
it should be possible as long as different tenants/customers are in different jobs. That is what I have. How can I get what I need?
sherzig
Veeam Software
Posts: 206
Liked: 46 times
Joined: Dec 05, 2018 2:44 pm
Contact:

Re: NAS Backup backup size

Post by sherzig »

Yes, you're right and wording needs to be improved. I also found a problem in my code where new read data is not handled correctly and I forgot to use the depth variable value as well.

Image

This is an example with a 1 GB file read on the source and written (compressed - value not readable) to the repository. DataTransferred is true. I added an additonal 1 GB file, this got backed up, but DataTransferred is False, event the number of transferred files is one. In the next run, no changes, everything looks good.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: NAS Backup backup size

Post by oleg.feoktistov » 1 person likes this post

Hi Daniel,

There is another approach that doesn't involve nas backup sessions.
Here is the powershell (with .NET methods) equivalent for what you see in nas backup properties in v12:

Code: Select all

$backups = Get-VBRNASBackup
foreach ($backup in $backups) {
    $points = Get-VBRNASBackupRestorePoint -NASBackup $backup
    foreach ($point in $points) {
    $pointInfo  = [Veeam.Backup.Core.CNasBackupPoint]::Get($point.Id)
      $point | select Id, NASServerName, @{n='BackupSize';e={$pointInfo.Info.ProtectedSize}}, @{n='OriginalSize';e={$pointInfo.Info.ReadSize}}
    }
    
}
I believe ProtectedSize and ReadSize properties should be the ones you are after.

Best regards,
Oleg
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

Thanks a lot Oleg! I only had to change the -Backup parameter to -NASBackup. ProtectedSize seems to be the size of the whole backup (for that share), presumably after that restorepoint was created, while ReadSize is the amount read for that particular restore point. I can definitely work with this.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: NAS Backup backup size

Post by oleg.feoktistov »

Sure thing. Thanks for noticing the false parameter, updated the code snippet. Thank you!
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

I'm sorry to be a bother, but I have had some time to test this a bit more, and I can't find that the actual backup size is available through powershell. ProtectedSize is not the size of the backup, it is (as I could have guessed) the size of the source data. I was misled by my first tests which were done using a backup job where the backup size was by chance almost identical to the source size. The only difference I have found between v11a and v12 is that in v12 the backup size is visible in the GUI, so it must(?) be in the database, but it looks like there is no way to get it with powershell. Since this would be valuable to have, probably not only for me but for many others, please see this as a feature request.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: NAS Backup backup size

Post by oleg.feoktistov »

Yeah, you are right, Daniel. Protected size refers to the Source size in the database. Thanks, didn't catch that. Looks like in the UI we reflect the backup size of nas backup short terms, and getting data on them is a bit tricky. But if you obtain short term data size and meta size and sum them up, numbers should add up to what you see in the UI:

Code: Select all

$backups = Get-VBRNASBackup

foreach ($backup in $backups) {
    $points = Get-VBRNASBackupRestorePoint -NASBackup $backup
    $backupInfo = [Veeam.Backup.Core.CNasBackup]::GetByNasPointId($points[0].Id)
    $shortTerm = $backupInfo.GetNasBackupShortTerm()
    $fullSize = [Math]::Round($shortTerm.Info.DataSize/1GB + $shortTerm.Info.MetaSize/1GB, 3)
    $backup | select Id, Name, @{n='BackupSize';e={$fullSize}}
}
Let me know if it has helped.

Best regards,
Oleg
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

Sorry for the long silence on this, I have been busy with upgrades to v12 and then to v12.1. I have tested the latest method now and unfortunately it doesn't add up. When I get the DataSize and MetaSize for this particular backup, and sum them up, I get 4682 GB. But the actual data on disk is 5750 GB, and this is also what is shown in the GUI (as 5.61 TB).

I found a method on the object returned by Veeam.Backup.Core.CNasBackup]::GetByNasPointId(), called GetSizeByRepository(), and that sounds promising. It requires a repository ID as parameter. But unfortunately the number returned is the same: 4682 GB! It would be interesting to know what this number actually refers to, since it's only a part of the actual backup size.
DanielJ
Service Provider
Posts: 199
Liked: 32 times
Joined: Jun 10, 2019 12:19 pm
Full Name: Daniel Johansson
Contact:

Re: NAS Backup backup size

Post by DanielJ »

Of course! The partial sum is only for one of the included shares, namely the one that happened to be backed up in $points[0]. We need to look at one point per share, to find the backup for that particular share, then sum it up. It's a bit unintuitive. Maybe Get-VBRUnstructuredBackup should return an array, since the different shares are anyway organized into one backup each. This is what I got working in the end:

Code: Select all

$backup = Get-VBRUnstructuredBackup -Name "My NAS job"
$points = Get-VBRUnstructuredBackupRestorePoint -Backup $backup
$sharebackup = @{}
$total = 0
foreach ($point in $points) {
  if (!($sharebackup.ContainsKey($point.ServerName))) {
    $sharebackup.Add($point.ServerName, $point)
  }
}
foreach ($share in $sharebackup.Keys) {
  $backupinfo = [Veeam.Backup.Core.CNasBackup]::GetByNasPointId($sharebackup[$share].Id)
  $shortterm = $backupinfo.GetNasBackupShortTerm()
  $fullsize = [Math]::Round(($shortterm.Info.DataSize + $shortterm.Info.MetaSize)/1GB, 2)
  $total += $fullsize
  "{0, -32} {1, 8}" -f $share, ($fullsize)
}
"{0, -32} {1, 8}" -f "Total:", $total
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests