Storage vMotion only one hard disk to another datastore in vSphere


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

Advertisements

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

  1. Pingback: Migrate individual disk « ICT-Freak.nl | drewreeves

  2. Pingback: ESXi on MacMini 6,2 | VirtuallyHyper

  3. Ashic Philip

    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?.

    Reply
  4. Hitesh

    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?

    Reply
    1. afokkema Post author

      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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s