Friday 29 July 2011

Copy vmware virtual machines

This works for copying virtual machines.

All this whilst virtual machine is powered off.

*Note: Create the folder that you are copying to, via \\uncpath of the NAS if you want to have correct rights to copy stuff off after. If created through ssh in vmware it will be hard work to copy off files later.

vmkfstools -i /vmfs/volumes/datastore/centOS/centOS.vmdk
 /vmfs/volumes/esxdatastore/centOS/centOS.vmdk

Repeat with other .vmdk files. e.g. centOS-000001.vmdk

The copying of the centOS.vmdk file copies the centOS-flat.vmdk also, so no need to try copying the centOS-flat.vmdk files themselves.

Then copy rest of files with 'cp'

Moving folders off NAS; make sure permissions are correct. User = vi-admin group = users, mode = 777. This is accomplished by creating the folder through the samba share in windows i.e \\uncpath-to-share on the NAS

NOTE:- Recently I had issues creating user vi-admin, I noticed the directory had a different user nfsnobod.  I then later realised that the 777 permissions were the permissions needed for the DIRECTORY not the files in the directory. Which as mentioned below should be 644. I was getting mixed up changing the files to 777.

NOTE ABOUT NOTE:- More will be revealed.... I seemingly had to change all the file permissions to 777 (which made them disappear from browsing samba) back to 644. Ok maybe they weren't 644 to begin with so in essence I just changed them to 644... errr... anyway..

Also make sure all files in folder -rw-r--r-- thats 644. http://www.draac.com/chmodchart.html


I tested the backup was successful by removing current vm from inventory and adding the one on the remote datastore to the inventory. Sometimes this was an issue like this error: "The Specified Key, Name, or Identifier Already Exists" http://communities.vmware.com/thread/79339

this was resolved by restarting management agents, I did this on the physical server, as the service command was not found, probably easy to find but couldnt be bothered at the time.

This then led onto the network card being sorted before it worked, see my other post: SIOCSIFADDR: No such device eth0



No comments:

Post a Comment