Hi all,
Most of you know it's possible to storage vMotion a single disk to another datastore through the GUI wizard using the "advanced" option.
We have a few VM's which have disks spread across datastores, now I want to reformat a few LUNs which once were upgraded from VMFS3. Normally I used a simple
get-vm -Datastore <Datastore> | Move-VM -Datastore <Datastore> -RunAsync -confirm:$false to move all the VM's from one datastore to another.
Problem is that we have a few servers with lots of data which are spread across some LUNs. I'm to lazy to manually "GUI-sVmotion" them to another LUN.I already tried "move-vm" function, neither I and "move-harddisk" function but can't get it to work with a single disk. I think it will be possible but can't see it somehow.
Easiest was something like :
get-datastore <Datastore> | get-harddisk | move-harddisk -datastore <Empty datastore>
Anyone got an idea/tip/script ?
Hi
You can youse Set-HardDisk cmdlets vSphere 5.5 Documentation Center like:
Get-HardDisk -vm <vmname> | where {$_.Name -eq "Hard disk 1"} | % {Set-HardDisk -harddisk $_ -Datastore <Datastore> -Confirm:$false}
Thanks,
Bayu
I think it could be easier but now got it working with the command below:
Get-HardDisk -vm (get-vm -Datastore "<old_datastore>") |where {$_.filename -match "<old_datastore>"} | Move-HardDisk -Datastore "<new_datastore>" -RunAsync -confirm:$false