VMware Cloud Community
eks1
Contributor
Contributor

Vmware ESX - moving one VMDK to another disk - what to do to work ? Edit the VMX file ?

 

I have an ESX VM with 2 disks --- for instance , disk 1 in SSD 240 and disk 2 in SSD 480

I want to move to another disks

copy/Move  disk 1 to  the the same host to the disk SSD 960

disk 1 at this moment - filename: windows 10-000002.vmdk  

and

copy/Move  disk 2 to  the the same host to the disk SSD 2 TB

disk 2 at this moment -  filename: windows 10_1.vmdk

I know how to copy , but after copying I have to edit the .VMX file ?  theres .vmx , .vmxf and .vmx~

Which one edit ?

Here's the full list of files I have now in my VM:

DISK 1::

-rw-r--r--    1 root     root      528.3K Aug  5 16:45 vmware-10.log

-rw-r--r--    1 root     root      418.5K Oct 15  2021 vmware-5.log

-rw-r--r--    1 root     root      932.6K Feb 14  2022 vmware-6.log

-rw-r--r--    1 root     root      389.5K Feb 14  2022 vmware-7.log

-rw-r--r--    1 root     root        2.6M Sep 27  2022 vmware-8.log

-rw-r--r--    1 root     root        2.2M Jul 24 15:46 vmware-9.log

-rw-r--r--    1 root     root        1.2M Aug 21 13:15 vmware.log

-rw-------    1 root     root      170.0M Aug  5 16:54 vmx-windows 10-750400100-1.vswp

-rw-------    1 root     root       23.7G Sep 26  2022 windows 10-000001-delta.vmdk

-rw-------    1 root     root         325 Sep 21  2022 windows 10-000001.vmdk

-rw-------    1 root     root      197.7G Aug 21 14:52 windows 10-000002-delta.vmdk

-rw-------    1 root     root         332 Aug 21 05:04 windows 10-000002.vmdk

-rw-------    1 root     root       20.0G Aug 20 23:42 windows 10-2cba3264.vswp

-rw-------    1 root     root       31.0K Sep 21  2022 windows 10-Snapshot53.vmsn

-rw-------    1 root     root       31.0K Sep 26  2022 windows 10-Snapshot54.vmsn

-rw-r--r--    1 root     root          13 Aug 21 05:05 windows 10-aux.xml

-rw-------    1 root     root      500.0G Sep 21  2022 windows 10-flat.vmdk

-rw-------    1 root     root        8.5K Aug 21 05:05 windows 10.nvram

-rw-------    1 root     root         502 Sep 21  2022 windows 10.vmdk

-rw-r--r--    1 root     root         778 Aug 21 05:05 windows 10.vmsd

-rw-r--r--    1 root     root        3.4K Aug 21 05:05 windows 10.vmx

-rw-------    1 root     root           0 Aug  5 16:51 windows 10.vmx.lck

-rw-------    1 root     root        3.1K Aug 20 23:59 windows 10.vmxf

-rw-r--r--    1 root     root        3.5K Aug 21 05:05 windows 10.vmx~

 

---

DISK 2:

-rw-------    1 root     root      440.0G Aug 21 14:54 windows 10_1-flat.vmdk

-rw-------    1 root     root         476 Aug 21 05:05 windows 10_1.vmdk

 

 

 

 

0 Kudos
3 Replies
a_p_
Leadership
Leadership

With - what I assume - ESXi 6.x, thin provisioned virtual disks, and snapshots which likely cause "SSD 240" to fill up, I'd suggest the following steps, which also assume that you do not need the snapshots anymore.

  1. shut down the VM
  2. unregister (don't delete) the VM from the ESXi host's inventory
  3. rename the VM's source folders on both SSDs to e.g. "windows 10-old"
  4. create new "windows 10" folders on the two target datastores
  5. copy the disks to the new location (adjust the datastore, and folder names if required)
    vmkfstools -i "/vmfs/volumes/SSD 240/windows 10-old/windows 10-000002.vmdk" -d thin "/vmfs/volumes/SSD 960/windows 10/windows 10.vmdk"
    vmkfstools -i "/vmfs/volumes/SSD 480/windows 10-old/windows 10_1.vmdk" -d thin "/vmfs/volumes/SSD 2 TB/windows 10/windows 10_1.vmdk"
  6. copy other required files from "SSD 240" to the new VM's folder on "SSD 960"
    windows 10.vmx
    windows 10.vmxf
    windows 10.nvram
    windows 10-aux.xml
  7. use e.g. the ls command to find out about the UUID of "SSD 2 TB"
  8. edit the VM's .vmx file (in the new location), and replace the UUID in the second virtual disk's path
  9. change the name of the VM's first virtual disk from "windows 10-000002.vmdk" to "windows 10.vmdk"
  10. register the VM from the ESXi host's GUI (right click the .vmx file)

If everything works as expected, you can then delete the two folders on the original datastores.

André

EDIT: Inserted step 9, which is necessary due to the snapshot consolidation.

0 Kudos
eks1
Contributor
Contributor

Thank very much

I will try all the steps you provided (in the order you sent)

Thank you very much again

0 Kudos
a_p_
Leadership
Leadership

Please note that I've added step 9 to the previously posted task list.

André

0 Kudos