PowerShell script exchange
Post Reply
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Instant disk recovery from prod to dev system

Post by kmbstech »

This is vmware with Pure storage for guest and vmdk files. I have a 6TB mssql database that I backup with backup repository as Pure Storage Snapshot. The database is spread across 5 vmdk files. I need to be able to attach the vmdk files with instant disk recovery to a dev system so the DBA can extract data and provide to another division daily. Once the data is retrieved I end the attach and the process is repeated daily. I am able to perform the tasks manually but not sure how to do this with power shell. I have run the Get-VBRBackup and the backup is not listed. I'm guessing since it is a snapshot and not a standard backup repository is the reason. I'm hoping someone has had a similar use case and can provide some guidance.
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Instant disk recovery from prod to dev system

Post by HannesK »

Hello,
if we talk about snapshots on the primary storage (no backup, just snapshots), then there are dedicated commands for these snapshots. Pure is one of the systems that uses the "Universal Storage API", so Get-StoragePluginSnapshot would be the starting point.

Best regards,
Hannes
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Instant disk recovery from prod to dev system

Post by kmbstech »

I'm a little unsure om my next steps. The get-VBRBackup does not return the job. I'm not sure of the method to mount the vmdk files to a different vm.
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Instant disk recovery from prod to dev system

Post by david.domask »

Hi @kmbstech,

Try the cmdlet Hannes mentioned -- Get-VBRBackup polls for backup files made, not storage snapshot, so you need to start with Get-StoragePluginSnapshot first and then parse out the snapshot you need.

You also will need to fetch the restorepoint with Get-VBRRestorePoint and filter on

Where-Object {$_.SnapshotID -eq $snapshot.id}

$snapshot should be populated from your Get-StoragePluginSnapshot.

Try working with that first and see what you come up with.
David Domask | Product Management: Principal Analyst
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Instant disk recovery from prod to dev system

Post by kmbstech »

I appreciate the reply. Thanks. Being a powershell novice is not easy. I hope you don't mind if I can pick your brain as I try to get this done. I have this

$snapshot = Get-StoragePluginSnapshot | Where { $_.Name -like '*DS35*' } | select -last 1

Which gives me the snapshot I want to use. Now I need to get the vm that has the vmdf files that I will use for instant disk recovery. That is using the Get-VBRRestorePoint?
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Instant disk recovery from prod to dev system

Post by david.domask »

Hi @kmbstech, sure I can get that, and it's not an easy project to cut your teeth on.

While checking in lab, I do need to confirm quick just that if these are imported snapshots not made by Veeam, this gets a bit more complex as SnapshotID is not preserved there.

Try:

$rps = Get-VBRRestorePoint | Where-Object {$_.Type -eq "Snapshot"}

This will return restorepoints from Storage Snapshots.

I believe you should then see your snapshot ID in this list, but you can confirm with $rps.SnapshotID and look for your snapshotID and see if it's there.
David Domask | Product Management: Principal Analyst
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Instant disk recovery from prod to dev system

Post by kmbstech »

Hello, when I run

$rps = Get-VBRRestorePoint -name server | Where-Object {$_.Type -eq "Snapshot"} | select -last 1

will return the correct restore point. This is using a veeam created snapshot.
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Instant disk recovery from prod to dev system

Post by david.domask »

Great :) If you're satisfied with this, you then can start the restore from it. I would ask if you can check the $rps.SnapshotID property for me and just confirm if it matches (I might have been wrong on this ID but my lab is in a weird state so not sure if it's related to that also)
David Domask | Product Management: Principal Analyst
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Instant disk recovery from prod to dev system

Post by kmbstech »

I have to look at this a little closer. When and add the -last 1 it doesn't seem to return the last one. That seems to pertain to the Pure snapshots as well as the snapshots with veeam. I will update with more info
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Instant disk recovery from prod to dev system

Post by kmbstech »

I finally have the command to get the last backup of a server with a Veeam snapshot backup.

Get-VBRRestorePoint -name servername | Sort-Object CreationTime | Where-Object {$_.Type -eq "Snapshot"}| select -last 1

returns the correct snapshot backup

VM Name Creation Time Type
------- ------------- ----
servername 7/28/2022 3:34:16 PM Snapshot

So I'm going to guess that I need to select the vmdk files out of that backup as next step? Get-VBRViVirtualDevice?
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Instant disk recovery from prod to dev system

Post by david.domask »

Hi @kmbstech,

Sorry for my delay, I was on holiday.

With the restore point, you can just start _any_ kind of restore you want. Are you wanting just disks or to do an entire VM restore?
David Domask | Product Management: Principal Analyst
kmbstech
Influencer
Posts: 11
Liked: never
Joined: Sep 09, 2021 3:21 pm
Full Name: kmbstech
Contact:

Re: Instant disk recovery from prod to dev system

Post by kmbstech »

Hello,

Thanks for the reply. I just needed to get some of the disks where the database is stored. The instant disk recovery has been configured and working as I need. Thanks for you assistance. I appreciate it.
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Instant disk recovery from prod to dev system

Post by david.domask »

Glad you got it going!

Hopefully your script ends up working well for you in the future, but don't hesitate to ask more :)
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests