• About
  • Manuals
  • Network
Confessions of a FreeBSD hacker Various tips & tricks about computers in general and FreeBSD in particular
Confessions of a FreeBSD hacker

Migrate VM to new datastore in ESXi

January 24, 2015 08:06 / Leave a Comment / Magnus Strahlert

As the free version of ESXi lack the option to migrate to a new datastore or host, it will have to be done manually. That’s easy enough by logging in to the ESXi shell by ssh and simply copying the VM files. Naturally the VM has to be powered off for the copy to be in a consistent state.

It’s very important to not have a trailing slash on the first path or the files within the directory will be copied, not the directory itself.

cp -pr /vmfs/volumes/olddatastore/vm /vmfs/volumes/newdatastore

However, the virtual disks format for some reason are not kept. In my tests using thin provisioned all over originally, suddenly the disks were eager zeroed thick provisioned when copied to the new datastore. This will remedy that, by first renaming the disk and then inflating the disk as thin provisioned.

cd /vmfs/volumes/newdatastore/vm
vmkfstools -E disk.vmdk disk-thick.vmdk
vmkfstools -i disk-thick.vmdk -d thin disk.vmdk
rm *thick*.vmdk

Then edit the VM configuration, remove the disk and re-add it and note that it now is thin provisioned instead.

Posted in: VMware / Tagged: esxi, vmware

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

Post Navigation

← Previous Post
Next Post →

Recent Posts

  • Takeaways utilising VFIO in a KVM virtual guest
  • Converting VM from ESXi to KVM with iSCSI storage
  • Deploying oVirt in self-hosted mode
  • Ansible playbook for handling perl on FreeBSD
  • iSCSI: Migrating from istgt to ctld

Tags

ansible backup carp chroot cluster cross-server esxi freebsd ftp ftpchroot gpt grub hast install iscsi kvm linux lun lvm mirror network nfs nfsroot ovirt pxe raid ramdrive raspberrypi snapshot ssd ssh terminalserver usb vfio virtio virtualbox vlan vmware volumes winxp zfs zpool zroot

Archives

  • July 2019
  • March 2018
  • February 2018
  • July 2017
  • February 2016
  • January 2015
  • August 2014
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • September 2012
  • July 2012
  • April 2012
  • March 2012
  • November 2011
  • August 2011

Recent Comments

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    © Copyright 2013-2016 - Magnus Strahlert
    Infinity Theme by DesignCoral / WordPress