VMware Cloud Community
ricky73
Hot Shot
Hot Shot
Jump to solution

clone virtual disk eager zero to lazy zeroed

I need to replace OS virtual disk (thick eager zeroed) of Windows 2012 server vm with another one of different type (thick lazy zeroed) because I've been unsuccessful to change it.

This behaviour is happened because initially disk was thin type and I converted it to thick eager zeroed  by "inflate" command, so now I'm not able to convert it to thick lazy zeroed using vmotion (Eager Zeroed Thick disks cannot be converted back to Thick using Storage vMotion, Cloning, Migration...

See KB 2145183

I thought to this way:

  • to create 2nd virtual disk (lazy zeroed) of the same size
  • clone to 1st disk to 2nd one
  • remove 1st disk
  • run vm with 2nd disk

I don't know how to clone disk, suggestions?

what do you think?

0 Kudos
1 Solution

Accepted Solutions
TheBobkin
Champion
Champion
Jump to solution

Hello Ricky,

If you can shut down the VM you can clone it to a new Lazy-Thick disk using vmkfstools via an SSH session to the host:

# vmkfstools -i /vmfs/volumes/datastoreName/VMName/VMName.vmdk /vmfs/volumes/datastoreName/VMName/VMName_NewName.vmdk -d zeroedthick

If you wish to retain the original name of the vmdk then you can make it in a new location e.g.:

# cd /vmfs/volumes/datastoreName/VMName

# mkdir temp

# vmkfstools -i /vmfs/volumes/datastoreName/VMName/VMName.vmdk /vmfs/volumes/datastoreName/VMName/temp/VMName.vmdk -d zeroedthick

- Detach the original disk from the VM and attach the new one located in the sub-directory (temp).

- Check that it is functional

- Move the original vmdk somewhere else until you are sure it can be deleted:

# cd /vmfs/volumes/datastoreName/VMName

# mkdir temp2

# mv VMName.vmdk temp2

# mv VMName-flat.vmdk temp2

Move the new disk up one level into the Namespace folder location:

#cd /vmfs/volumes/datastoreName/VMName/temp

# mv VMName.vmdk ..

# mv VMName-flat.vmdk ..

Alternatively you can just add this cloned disk to a new VM as you suggested (and create it with the same disk name in a new VM namespace folder).

You can check whether is thick or eagerthick using vmkfstools -t0 <NameofVM.vmdk>

https://kb.vmware.com/kb/1011170

Or you can check by attaching the disk and looking at the details on the pull-down information for the disk via 'Edit Settings' of the VM via the vSphere client.

Bob

-o- If you found this comment useful please click the 'Helpful' button and/or select as 'Answer' if you consider it so, please ask follow-up questions if you have any -o-

View solution in original post

0 Kudos
3 Replies
a_p_
Leadership
Leadership
Jump to solution

Why don't you the KB article, and clone the virtual disk to a thin provisioned disk, and then clone it again to thick?

If you need help, please provide some information about your environment, like vSphere license type, free disk space on datastore(s), the virtual disk's size, ...


André

0 Kudos
ricky73
Hot Shot
Hot Shot
Jump to solution

>Why don't you the KB article, and clone the virtual disk to a thin provisioned disk, and then clone it again to thick?

clone or migrate?

I'll try to migrate disk to thin and again to thick lazy zeroed.

I don't know how to clone the virtual disk to another one.

My environment is ESXi 5.5 update 3, vSphere Enterprise  edition, datastore is 2 TB and 1 TB is free space.

0 Kudos
TheBobkin
Champion
Champion
Jump to solution

Hello Ricky,

If you can shut down the VM you can clone it to a new Lazy-Thick disk using vmkfstools via an SSH session to the host:

# vmkfstools -i /vmfs/volumes/datastoreName/VMName/VMName.vmdk /vmfs/volumes/datastoreName/VMName/VMName_NewName.vmdk -d zeroedthick

If you wish to retain the original name of the vmdk then you can make it in a new location e.g.:

# cd /vmfs/volumes/datastoreName/VMName

# mkdir temp

# vmkfstools -i /vmfs/volumes/datastoreName/VMName/VMName.vmdk /vmfs/volumes/datastoreName/VMName/temp/VMName.vmdk -d zeroedthick

- Detach the original disk from the VM and attach the new one located in the sub-directory (temp).

- Check that it is functional

- Move the original vmdk somewhere else until you are sure it can be deleted:

# cd /vmfs/volumes/datastoreName/VMName

# mkdir temp2

# mv VMName.vmdk temp2

# mv VMName-flat.vmdk temp2

Move the new disk up one level into the Namespace folder location:

#cd /vmfs/volumes/datastoreName/VMName/temp

# mv VMName.vmdk ..

# mv VMName-flat.vmdk ..

Alternatively you can just add this cloned disk to a new VM as you suggested (and create it with the same disk name in a new VM namespace folder).

You can check whether is thick or eagerthick using vmkfstools -t0 <NameofVM.vmdk>

https://kb.vmware.com/kb/1011170

Or you can check by attaching the disk and looking at the details on the pull-down information for the disk via 'Edit Settings' of the VM via the vSphere client.

Bob

-o- If you found this comment useful please click the 'Helpful' button and/or select as 'Answer' if you consider it so, please ask follow-up questions if you have any -o-

0 Kudos