Sometimes it’s necessary to only migrate a single hard disk from a VM. This is the case when someone adds two 1 TB VMDK’s and fills them up completely. The maximum size of a VMFS datastore is 2TB minus 512 bytes. So in this case the datastore will be completely filled with no space left to keep the VM running. So if you want  to migrate just one hard disk to make sure the VMFS datastore will not fill up. You can use the vSphere client or PowerCLI to do perform this “advanced” Storage vMotion.

Note: if you want to reclaim your “wasted” storage back from your SAN, you have to recycle the whole datastore. So you have to migrate the other hard disks and configuration files as well.

vSphere Client

Start the Migrate Virtual Machine wizard and select datastore:

image

In the Select Datastore wizard, click the Advanced button:

image

Now you’re able to select the hard disk you want to migrate and the datastore. Don’t change the other settings:

image

Review the summary and press finish to execute this Storage vMotion:

image

PowerCLI

Or you can use the following PowerCLI one-liner to migrate the Hard disk:

Get-HardDisk -vm <vmname>  | Where {$_.Name -eq "Hard disk <#>"} | `
% {Set-HardDisk -HardDisk $_ -Datastore "<datastore>" -Confirm:$false}

The following output will be generated:

image

9 thoughts on “Storage vMotion only one hard disk to another datastore in vSphere

  1. I tried this and Iam getting the error “a general system error occured , failed to start disk migration”. Do you know what can will be the reason?.

  2. Suppose I have two esxi hosts and I am using the both machine’s HDD as their datastore. So can I do vmotion in this environment where there is no shared storage?

    1. Yes, if you are running vSphere 5.5 or higher it’s possible to Storage vMotion the virtual machines. You have to use the vSphere Web Client to perform the action. I assume you have a vCenter server running because that’s a requirement too.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.