ffrancisco
Contributor
Contributor

Resignature a VMFS Datastore Copy

Jump to solution

anyone know of or seen a powercli script to mount a new disk/lun and "assign a new signature" on the same time?  it works well on the gui, but I'm trying to automate the process.  any help is appreciated.

https://docs.vmware.com/en/VMware-vSphere/5.5/com.vmware.vsphere.hostclient.doc/GUID-5A4E2248-12CB-4...

Procedure

  1. Log in to the vSphere Client and select the server from the inventory panel.
  2. Click the Configuration tab and click Storage in the Hardware panel.
  3. Click Add Storage.
  4. Select the Disk/LUN storage type and click Next.
  5. From the list of LUNs, select the LUN that has a datastore name displayed in the VMFS Label column and click Next.   The name present in the VMFS Label column indicates that the LUN is a copy that contains a copy of an existing VMFS datastore.
  6. Under Mount Options, select Assign a New Signature and click Next.
  7. In the Ready to Complete page, review the datastore configuration information and click Finish.
0 Kudos
1 Solution

Accepted Solutions
ffrancisco
Contributor
Contributor

thanks LucD. I figured out the rest.  appreciate the help

$volumelabel = "Volume Name"

$esxcli = Get-EsxCli -VMhost esxhost

$esxcli.storage.vmfs.snapshot.resignature($volumelabel)

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership

Try something like this.

The volume will be mounted after the resignature.

You can also use the volumeuuid instead of the volumenlabel

$esxcli = Get-EsxCli -VMhost MyEsx -V2

$resig = @{

    volumelabel = 'VMFS-Snap'

}

$esxcli.storage.vmfs.snapshot.resignature.Invoke($resig)


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

0 Kudos
ffrancisco
Contributor
Contributor

Hi LucD - I got an error.  thx for the assistance.

PowerCLI H:\powershell\shadowimage_clone> .\resignature.ps1
Get-EsxCli : A parameter cannot be found that matches parameter name 'V2'.
At H:\powershell\shadowimage_clone\resignature.ps1:1 char:55
+ $esxcli = Get-EsxCli -VMhost usdenvsp102.corp.hds.com -V2
+                                                       ~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-EsxCli], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEsxCli

You cannot call a method on a null-valued expression.
At H:\powershell\shadowimage_clone\resignature.ps1:5 char:1
+ $esxcli.storage.vmfs.snapshot.resignature.Invoke($resig)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

##then I removed the V2###

PowerCLI H:\powershell\shadowimage_clone> .\resignature.ps1

Exception calling "Invoke" with "1" argument(s): "Message: No unresolved VMFS snapshots with volume label 'System.Collections.Hashtable' found.;

InnerText: No unresolved VMFS snapshots with volume label 'System.Collections.Hashtable' found.EsxCLI.CLIFault.summary"

At H:\powershell\shadowimage_clone\resignature.ps1:5 char:1

+ $esxcli.storage.vmfs.snapshot.resignature.Invoke($resig)

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : ViError

0 Kudos
ffrancisco
Contributor
Contributor

thanks LucD. I figured out the rest.  appreciate the help

$volumelabel = "Volume Name"

$esxcli = Get-EsxCli -VMhost esxhost

$esxcli.storage.vmfs.snapshot.resignature($volumelabel)

View solution in original post

0 Kudos
LucD
Leadership
Leadership

That's strange, look slike you are using the Get-EsxCli V2 version, but the resignature is not a V2 command.

Could it be that you are on a somewhat older PowerCLI version? Do a Get-PowerCLIVersion.


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

0 Kudos
ffrancisco
Contributor
Contributor

thx again for your help.

here is the version.

PowerCLI H:\powershell\shadowimage_clone> get-powercliversion

PowerCLI Version
----------------
   VMware vSphere PowerCLI 6.0 Release 3 build 3205540
---------------
Component Versions
---------------
   VMWare AutoDeploy PowerCLI Component 6.0 build 2358282
   VMWare ImageBuilder PowerCLI Component 6.0 build 2358282
   VMware vSphere PowerCLI Component 6.0 build 3205541

0 Kudos
LucD
Leadership
Leadership

Ok, that one doesn't have the V2 option yet.

You should perhaps consider upgrading your PowerCLI version.


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

0 Kudos