VMware Cloud Community
Hiront
Enthusiast
Enthusiast
Jump to solution

Storage Path setting migrate

Hi expert

I will upgrade ESXi 4.1 to ESXi5.1

But We upgrade process use clean install because replace usb boot to network boot.

How to migrate disk path setting?

I using Prefered path, and different for each host.

Could you help me or any idia?

Best regards

Hironori

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Use the following versions of the scripts.

For the export

Get-VMHost |
Get-ScsiLun -LunType disk |
Select @{N="VMHost";E={$_.VMHost.Name}},CanonicalName,MultipathPolicy,
 
@{N="Preferred";E={
   
if($_.MultipathPolicy -eq "Fixed"){
     
Get-ScsiLunPath -ScsiLun $_ | where {$_.Preferred} |
     
Select -ExpandProperty Name
    }
  }}
|
Export-Csv C:\Lun-Path-Policy.csv -NoTypeInformation -UseCulture

And for the import

Import-Csv C:\Lun-Path-Policy.csv -UseCulture | %{
 
$lun = Get-ScsiLun -CanonicalName $_.CanonicalName -VMHost $_.VMHost -LunType disk
 
if($_.MultiPathPolicy -eq "Fixed"){}
   
$prefPath = $_.Preferred
   
$path = Get-ScsiLunPath -ScsiLun $lun | where {$_.Name -eq $prefPath}
   
Set-ScsiLun -ScsiLun $lun -MultipathPolicy $_.MultiPathPolicy -Confirm:$false -PreferredPath $path
 
else{
   
Set-ScsiLun -ScsiLun $lun -MultipathPolicy $_.MultiPathPolicy -Confirm:$false
  }
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
9 Replies
Hiront
Enthusiast
Enthusiast
Jump to solution

Sorry! additional.

How to dump pathsetting before upgrade ?

And

how to set path againg after upgrade ?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Use this for the export

Get-VMHost |
Get-ScsiLun -LunType disk |
Select @{N="VMHost";E={$_.VMHost.Name}},CanonicalName,MultipathPolicy |
Export-Csv C:\Lun-Path-Policy.csv -NoTypeInformation -UseCulture

And you configure the path policy with this

Import-Csv C:\Lun-Path-Policy.csv -UseCulture | %{
 
Get-ScsiLun -CanonicalName $_.CanonicalName -VmHost $_.VMHost -LunType disk |
 
Set-ScsiLun -MultipathPolicy $_.MultiPathPolicy -Confirm:$false
}

Try this out in a test environment before you use it in your live environment !


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Hiront
Enthusiast
Enthusiast
Jump to solution

Thank you for your reply.

I try it soon.

Additinal.

Could you tell me how to migrate preferd path setting?

Sorry

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Use the following versions of the scripts.

For the export

Get-VMHost |
Get-ScsiLun -LunType disk |
Select @{N="VMHost";E={$_.VMHost.Name}},CanonicalName,MultipathPolicy,
 
@{N="Preferred";E={
   
if($_.MultipathPolicy -eq "Fixed"){
     
Get-ScsiLunPath -ScsiLun $_ | where {$_.Preferred} |
     
Select -ExpandProperty Name
    }
  }}
|
Export-Csv C:\Lun-Path-Policy.csv -NoTypeInformation -UseCulture

And for the import

Import-Csv C:\Lun-Path-Policy.csv -UseCulture | %{
 
$lun = Get-ScsiLun -CanonicalName $_.CanonicalName -VMHost $_.VMHost -LunType disk
 
if($_.MultiPathPolicy -eq "Fixed"){}
   
$prefPath = $_.Preferred
   
$path = Get-ScsiLunPath -ScsiLun $lun | where {$_.Name -eq $prefPath}
   
Set-ScsiLun -ScsiLun $lun -MultipathPolicy $_.MultiPathPolicy -Confirm:$false -PreferredPath $path
 
else{
   
Set-ScsiLun -ScsiLun $lun -MultipathPolicy $_.MultiPathPolicy -Confirm:$false
  }
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Hiront
Enthusiast
Enthusiast
Jump to solution

Feedback!

Script error occur "Set-ScsiLun If the Multipathpolicy parameter is set to 'Fixed', you must specify the PreferredPath parameter".

I can`t found Preferred parameter in get-scsilun commandlet output.

thank you.

Hiro

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I updated the import script above, please try again.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Hiront
Enthusiast
Enthusiast
Jump to solution

Feedback!

Second script Error occurs "set-scsilun : paramter 'ScsiLun' can not bind."

???

Reply
0 Kudos
Hiront
Enthusiast
Enthusiast
Jump to solution

OK I retry it

Reply
0 Kudos
Hiront
Enthusiast
Enthusiast
Jump to solution

Hi LucD

your script work fine!

Thank you very much

hiro

Reply
0 Kudos