Skip to content

Commit afd916c

Browse files
committed
create/modify volumeset
example to create the initial volume set.. example to modify a volume set by either adding or removing volumes.
1 parent bd577bf commit afd916c

File tree

4 files changed

+138
-4
lines changed

4 files changed

+138
-4
lines changed

demos-backupsdk/Protection Group Database Refresh/Protection Group Database Refresh physical BackupSDK.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ $ProtectionGroupName = 'SqlServer1_Pg' # Protection
3838
$VolumeSet = 'volset1' # Name of the Volume Set
3939
$SourcePath = 's:\,t:\' # Path of Volumes to Snapshot
4040
$TargetPath = 'n:\,m:\' # Path of Volumes to Mount
41-
$VolumeType = 'physical' # Physical, vVol, or pRDM
41+
$VolumeType = 'physical' # Physical, vVol, or RDM
4242

4343

44-
# Set Credentials - this assumes the same credential for the target SQL Server and the FlashArray. If this is a VMware VM using pRDM or vVol, a vCenter credential is required.
44+
# Set Credentials - this assumes the same credential for the target SQL Server and the FlashArray. If this is a VMware VM using RDM or vVol, a vCenter credential is required.
4545
$FlashArrayCredential = Get-Credential
4646
$SQLServerCredential = Get-Credential
4747

demos-backupsdk/Protection Group Database Refresh/Protection Group Database Refresh vVol BackupSDK.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ $ProtectionGroupName = 'SqlServer1_Pg' # Protection
3838
$VolumeSet = 'volset1' # Name of the Volume Set
3939
$SourcePath = 's:\' # Path of Volumes to Snapshot
4040
$TargetPath = 'n:\' # Path of Volumes to Mount
41-
$VolumeType = 'vvol' # Physical, vVol, or pRDM
41+
$VolumeType = 'vvol' # Physical, vVol, or RDM
4242
$vCenterAddress = 'vcenter.example.com' # vCenter Server
4343
$SourceVMName = 'sqlvm4' # Source VM
4444
$TargetVMName = 'sqlvm5' # Target VM
4545

46-
# Set Credentials - this assumes the same credential for the target SQL Server and the FlashArray. If this is a VMware VM using pRDM or vVol, a vCenter credential is required.
46+
# Set Credentials - this assumes the same credential for the target SQL Server and the FlashArray. If this is a VMware VM using RDM or vVol, a vCenter credential is required.
4747
$FlashArrayCredential = Get-Credential
4848
$SQLServerCredential = Get-Credential
4949
$vCenterCredential = Get-Credential
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Protection Group Database Refresh
2+
**Protection Group Database Refresh Scripts**
3+
<p align="center"></p>
4+
These examples demonstrate how to initially create a Volume Set. Additional examples demonstrate how to add or
5+
subtrace volumes from a volume set. Remember that cmdlets involving Volume Sets will check to ensure all Volumes
6+
are members of the declared Protection Group.
7+
<BR><BR>
8+
9+
10+
**Files:**
11+
- VolumeSet-Example.ps1
12+
13+
<!-- wp:separator -->
14+
<hr class="wp-block-separator"/>
15+
<!-- /wp:separator -->
16+
17+
**Scenario:**
18+
<BR>These examples demonstrate how to initially create a Volume Set. Additional examples demonstrate how to add or
19+
subtrace volumes from a volume set. Remember that cmdlets involving Volume Sets will check to ensure all Volumes
20+
are members of the declared Protection Group.
21+
22+
**Prerequisites:**
23+
1. Administrator Credentials for a Windows Server and FlashArray.
24+
2. Install the PureStorage.FlashArray.Backup module.
25+
3. (optional) If a VMware VM using RDM or vVol, an Administrator Credential for vCenter.
26+
27+
**Usage Notes:**
28+
<BR>Each example is an independent example showing how to initially create a Volume Set, or to modify the members of a Volume Set.
29+
30+
<!-- wp:separator -->
31+
<hr class="wp-block-separator"/>
32+
<!-- /wp:separator -->
33+
34+
**Disclaimer:**
35+
<BR>
36+
This example script is provided AS-IS and meant to be a building block to be adapted to fit an individual organization's infrastructure.
37+
<BR>
38+
<BR>
39+
40+
We encourage the modification and expansion of these scripts by the community. Although not necessary, please issue a Pull Request (PR) if you wish to request merging your modified code in to this repository.
41+
42+
<!-- wp:separator -->
43+
<hr class="wp-block-separator"/>
44+
<!-- /wp:separator -->
45+
46+
_The contents of the repository are intended as examples only and should be modified to work in your individual environments. No script examples should be used in a production environment without fully testing them in a development or lab environment. There are no expressed or implied warranties or liability for the use of these example scripts and templates presented by Pure Storage and/or their creators._
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
##############################################################################################################################
2+
# VolumeSet Example - Create or Modify
3+
#
4+
# Scenario:
5+
# This script will show examples in how to initially create a Volume Set, and what has to be changed if you need
6+
# Modify the number of volumes in the Volume Set.
7+
# Prerequisities:
8+
# 1. Install the PureStorage.FlashArray.Backup module
9+
# 2. Have FlashArray administrator, Windows Server, and if a VMware VM, vCenter credentials.
10+
#
11+
# Usage Notes:
12+
# These simple example show how to initially create and later modify a Volume Set that can be used
13+
# for creating snapshots and mounting those snapshots.
14+
#
15+
# Disclaimer:
16+
# This example script is provided AS-IS and meant to be a building block to be adapted to fit an individual
17+
# organization's infrastructure.
18+
##############################################################################################################################
19+
20+
21+
22+
# Import powershell modules
23+
Import-Module PureStorage.FlashArray.Backup
24+
25+
26+
27+
# Declare variables
28+
$SourceSQLServer = 'SqlServer1' # Name of source SQL Server
29+
$SourceArrayName = 'flasharray1.example.com' # Source FlashArray FQDN
30+
$ProtectionGroupName = 'SqlServer1_Pg' # Protection Group name in the FlashArray
31+
$VolumeSet = 'volset1' # Name of the Volume Set
32+
$SourcePath = 's:\' # Path of Volumes to Snapshot
33+
$VolumeType = 'vvol' # Physical, vVol, or RDM
34+
$vCenterAddress = 'vcenter.example.com' # vCenter Server
35+
$SourceVMName = 'sqlvm4' # Source VM
36+
37+
# Set Credentials - this assumes the same credential for the target SQL Server and the FlashArray. If this is a VMware VM using pRDM or vVol, a vCenter credential is required.
38+
$FlashArrayCredential = Get-Credential
39+
$SQLServerCredential = Get-Credential
40+
$vCenterCredential = Get-Credential
41+
42+
# Volume Sets can be manually created by specifying a set of volumes on a target Windows Server.
43+
# New-PsbVolumeSet will connected to the declared ComputerAddress and match the drive letters and mount points
44+
# to the corresponding volumes on the FlashArray. If VMware RDM/vVol additional parameters are required to
45+
# assist in matching those supported disk types to Pure Storage Volumes.
46+
47+
# Example 1: Create a new volume set where the target computeraddress is a server that has a Host Record on
48+
# the FlashArray. This includes vHBA, in-guest iSCSI, and bare metal servers.
49+
50+
$VolumeType = 'Physical'
51+
New-PsbVolumeSet -VolumeSetName $VolumeSet -ComputerAddress $SourceSQLServer -ComputerCredential $SQLServerCredential -FlashArrayAddress $SourceArrayName -FlashArrayCredential $FlashArrayCredential -Path $SourcePath -VolumeType $VolumeType
52+
53+
# Example 2: Create a new volume set where the target computeraddress is a VMware VM using physical RDMs.
54+
# Note the query for the VMPID is optional, but if that is not passed and VM is renamed in vCenter,
55+
# it will fail to find the VM if the -VMname parameter is not modified to the new VM name.
56+
$VMPID = Get-PSBVMPersistentId -VCenterAddress $vCenterAddress -VCenterCredential $vCenterCredential -VMName $SourceVMName
57+
$VolumeType = 'RDM'
58+
New-PsbVolumeSet -VolumeSetName $VolumeSet -ComputerAddress $SourceSQLServer -ComputerCredential $SQLServerCredential -FlashArrayAddress $SourceArrayName -FlashArrayCredential $FlashArrayCredential -Path $SourcePath -VolumeType $VolumeType -VCenterAddress $vCenterCredential -VMName $SourceVMName -VMPersistentId $VMPID
59+
60+
# Example 3: Create a new volume set where the target computeraddress is a VMware VM using virtual volumes (vVol).
61+
# Note the query for the VMPID is optional, but if that is not passed and VM is renamed in vCenter,
62+
# it will fail to find the VM if the -VMname parameter is not modified to the new VM name.
63+
$VMPID = Get-PSBVMPersistentId -VCenterAddress $vCenterAddress -VCenterCredential $vCenterCredential -VMName $SourceVMName
64+
$VolumeType = 'vvol'
65+
New-PsbVolumeSet -VolumeSetName $VolumeSet -ComputerAddress $SourceSQLServer -ComputerCredential $SQLServerCredential -FlashArrayAddress $SourceArrayName -FlashArrayCredential $FlashArrayCredential -Path $SourcePath -VolumeType $VolumeType -VCenterAddress $vCenterCredential -VMName $SourceVMName -VMPersistentId $VMPID
66+
67+
# Example 4: Building upon Example 1
68+
# Modify a volume set by adding a disk in the path. In this example the Volume Set already exists, and only
69+
# one disk, the 's:\' disk, is in the volume set. The Invoke-PsbSnapshotJob will see the drive letters
70+
# and mount points in the path, and check that they are all marked as belonging to the Volume Set. If any of the
71+
# declared volumes are not in the volume set, powershell will ask you to confirm overwriting the volume set on
72+
# the FlashArray with the new set of disks. Simply changing the -Path parameter is not sufficient, as all
73+
# volumes declared in the -path must be members of the declared -pgroupname or the invoke-psbsnapshotjob will fail
74+
# with an error indicating that all of the volumes in the Volume Set are not members of the declared Protection Group.
75+
76+
$SourcePath = 's:\,t:\' # Path of Volumes to Snapshot
77+
Invoke-PsbSnapshotJob -vcenteraddress $vcenteraddress -VcenterCredential $vcentercredential -vmname $sourceVMName -FlashArrayAddress $SourceArrayName -FlashArrayCredential $FlashArrayCredential -VolumeSetName $VolumeSet -VolumeType $VolumeType -ComputerAddress $SourceSQLServer -ComputerCredential $SQLServerCredential -Path $SourcePath -pgroupname $ProtectionGroupName
78+
79+
# Example 5: Building upon Example 4
80+
# Modify a volume set by removing a disk in the path. In this example the Volume Set already exists, and
81+
# two disks the 's:\,t:\' disks are members of the volume set. The Invoke-PsbSnapshotJob will see the drive letters
82+
# and mount points in the path, and check that they are all marked as belonging to the Volume Set. If any volumes on
83+
# the FlashArray are members of the Volume Set but not included in the -path parameter, powershell will ask you to
84+
# confirm overwriting the volume set on the FlashArray with the new set of disks. This action will not remove
85+
# volumes from the declared protection group.
86+
87+
$SourcePath = 's:\' # Path of Volumes to Snapshot
88+
Invoke-PsbSnapshotJob -vcenteraddress $vcenteraddress -VcenterCredential $vcentercredential -vmname $sourceVMName -FlashArrayAddress $SourceArrayName -FlashArrayCredential $FlashArrayCredential -VolumeSetName $VolumeSet -VolumeType $VolumeType -ComputerAddress $SourceSQLServer -ComputerCredential $SQLServerCredential -Path $SourcePath -pgroupname $ProtectionGroupName

0 commit comments

Comments
 (0)