UNSOLVED

ATEAGunnar

updated

7 years ago

A

ATEAGunnar

1 Rookie

7 Posts

0

1384

June 20th, 2019 04:00

Create a view volume in a different directory than source volume with Powershell

Hi,

I want to create a new viewvolume from a replay, but I want the Viewvolume to be created in a different folder than the original as I will map it out to a different server.

How do I get the Volumefolder parameter? The only info in the Cookbook is referenced to have the volume created in the same directory.

 

Code example: 

$VolumeD = Get-DellScVolume -ConnectionName $ConnName `
-ScName $ScName `
-VolumeFolderPath $VolumeFolderPath `
-Name $VolumeNameD


# Get the latest frozen snapshot (Replay) on the volume
$ReplayD = Get-DellScReplay -ConnectionName $ConnName `
-ScName $ScName `
-CreateVolume $VolumeD `
-Active:$false `
| Sort-Object { [datetime]$_.FreezeTime }, `
{ [UInt32] ( $_.GlobalIndex.Split( "-" ) )[-1] } `
| Select-Object -Last 1

########## Create view volumes ########

$ViewVolumeD = New-DellScReplayView -ConnectionName $ConnName `
-Instance $ReplayD `
-Name $ViewVolumeNameD `
-VolumeFolder ???????????

  • DELL-Bob Mi

    2 Intern

    230 Posts

    1269

    1

    Posted June 20th, 2019 15:00

    Hello ATEAGunnar,
    Based upon the commands you specified you are using Dell Storage PowerShell SDK.

    Looking at the Dell Storage PowerShell SDK Cookbook: http://en.community.dell.com/techcenter/extras/m/white_papers/20441893

    Section 3.6.2 Create a view volume on a snapshot

    # Assign variables
    $ConnName = "DSMDC"
    $ScName = "SC 13"
    $VolumeName = "SQLData"
    $VolumeFolderPath = "Production/SQLDatabase/SQLProd/"
    $ViewVolumeName = $VolumeName + " View"

    I would add one more variable to this list:
    $ViewVolumeFolder = "ViewVolumeFolder"


    Then when you create the view volume:

    # Create the view volume in the same folder as the volume
    $ViewVolume = New-DellScReplayView -ConnectionName $ConnName `
    -Instance $Replay `
    -Name $ViewVolumeName `
    -VolumeFolder $ViewVolumeFolder

    Unfortunately I do not have a lab system to test this on to verify.

  • ATEAGunnar

    1 Rookie

    7 Posts

    1189

    0

    Posted June 28th, 2019 01:00

    Thanks for the replay @DELL-Bob Mi that pointed me in the correct direction.

    There was a section in the Cookbook around moving Volumes to a different folder.

    so my solution was to first create the volume in the same folder as the original and then move it tio the correct folder.

    Like this:

    ################## Create View Volumes from snapshot ########################

    write-host "create new volumes from snapshot..."

    # Get the volumes
    $VolumeD = Get-DellScVolume -ConnectionName $ConnName `
    -ScName $ScName `
    -VolumeFolderPath $VolumeFolderPath `
    -Name $VolumeNameD
    $VolumeL = Get-DellScVolume -ConnectionName $ConnName `
    -ScName $ScName `
    -VolumeFolderPath $VolumeFolderPath `
    -Name $VolumeNameL

    # Get the latest frozen snapshot (Replay) on the volume
    $ReplayD = Get-DellScReplay -ConnectionName $ConnName `
    -ScName $ScName `
    -CreateVolume $VolumeD `
    -Active:$false `
    | Sort-Object { [datetime]$_.FreezeTime }, `
    { [UInt32] ( $_.GlobalIndex.Split( "-" ) )[-1] } `
    | Select-Object -Last 1

    $ReplayL = Get-DellScReplay -ConnectionName $ConnName `
    -ScName $ScName `
    -CreateVolume $VolumeL `
    -Active:$false `
    | Sort-Object { [datetime]$_.FreezeTime }, `
    { [UInt32] ( $_.GlobalIndex.Split( "-" ) )[-1] } `
    | Select-Object -Last 1

    ########## Create view volumes ########

    $ViewVolumeD = New-DellScReplayView -ConnectionName $ConnName `
    -Instance $ReplayD `
    -Name $ViewVolumeNameD

    $ViewVolumeL = New-DellScReplayView -ConnectionName $ConnName `
    -Instance $ReplayL `
    -Name $ViewVolumeNameL

    ###### Move newly created voumes to the correct Volume folder ##########
    # Get the new volume folder
    $NVolumeFolder = Get-DellScVolumeFolder -ConnectionName $ConnName `
    -ScName $ScName `
    -FolderPath $SCVolumeFolderPath `
    -Name $ScVolumeFolderName
    # Move the volume

    $DestinationD = Set-DellScVolume -ConnectionName $ConnName -Instance $ViewVolumeD -VolumeFolder $NVolumefolder

    $DestinationL = Set-DellScVolume -ConnectionName $ConnName -Instance $ViewVolumeL -VolumeFolder $NVolumefolder