I have 6 VMs with 13 disks each on 72 different datastores (2TB limit was really limiting). Extents led to terrible performance, so the best course of action was individual disks on individual datastores (1 vmdk to 1 datastore ratio). We are now migrating all these 72 vmdk's to 72 new datastores on new storage. In the past, we have done these Storage VMotions via PowerCli either by datastore or by VM to a specified datastore in a comma-delimited file.
I was trying to figure out what the command line would be as I could insert the appropriate Hard Disks and datastores in the "for each" command. The set-harddisk command was not working. Can you see where I went wrong?
The Get-Harddisk cmdlet with the Datastore parameter returns also .vmdk files that are not connected to a VM.
A svMotion has to update the VM's .vmx file as well.
Try it perhaps like this
Get-VM -Datastore "HO-CX3-FC-Phopdnode03-1m" | Get-Harddisk | `
where {$_.Filename -match "HO-CX3-FC-Phopdnode03-1m"} | `
Set-Harddisk -Datastore "ho_na3_phopdnode03_12"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The Get-Harddisk cmdlet with the Datastore parameter returns also .vmdk files that are not connected to a VM.
A svMotion has to update the VM's .vmx file as well.
Try it perhaps like this
Get-VM -Datastore "HO-CX3-FC-Phopdnode03-1m" | Get-Harddisk | `
where {$_.Filename -match "HO-CX3-FC-Phopdnode03-1m"} | `
Set-Harddisk -Datastore "ho_na3_phopdnode03_12"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I received a slightly different error message this time. (Name changed to reflect the new datastore)
Confirm
Are you sure you want to perform this action?
Performing operation "Setting Datastore: ho_na3_phopdnode05_12." on Target
"Hard disk 13".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):y
Set-HardDisk : 8/10/2011 9:08:46 AM Set-HardDisk The operation for th
e entity VirtualMachine-1328 failed with the following message: "The operation
is not supported on the object."
At line:1 char:131
+ Get-VM -Datastore "HO-CX3-FC-Phopdnode05-1m" | Get-Harddisk | where {$_.Filen
ame -match "HO-CX3-FC-Phopdnode05-1m"} | Set-Harddisk <<<< -Datastore "ho_na3_
phopdnode05_12"
+ CategoryInfo : NotSpecified: (:) [Set-HardDisk], NotSupported
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpda
tes_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDe
vice.SetHardDisk
Are you connected to the vCenter or to an ESX(i) server ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am connecting to be an ESX 4.1 Build 320092 host, and I am performing this function on the host that owns the virtual machine.
That's the explanation.
In the Set-Harddisk it says that the Datastore parameter is only supported when you are connected to a vCenter.
The alternative could be to use the SDK method called RelocateVM_Task
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks that solved my problem. I thought I read somewhere set-harddisk needed to be run on the host itself, but I must have misunderstood. Running it from vCenter makes my life in scripting the move much easier. Thanks again!