Showing posts with label vmware. Show all posts
Showing posts with label vmware. Show all posts

Wednesday, June 5, 2013

Moving virtual disks outside of vmware. The confusing flat files and descriptor files.

When using vSphere Datastore Browser, you will a see a large file like server1.vmdk. The file will be close to the size of the virtual machine. If you download the machine and move it to another vmware host, it will not work! There is a descriptor file that is hidden from the Datastore Browser.

This is my solution:

Enable SSH on the vmware host.
Use putty to connect to the host.
Find the location of the virtual machine.

cd /vmfs/volumes/my_datastore/server1
ls -l

Now I see two vmdk files.

server1.vmdk        (Small descriptor file. But this is the name of the large file earlier?)
server1-flat.vmdk  (Large flat file.)

mv server1.vmdk server1.temp

I renamed the descriptor file and now it is viewable in the Datastore Browser. Now I can download or backup my virtual machine. If you want to move to another host, rename the small file to the original name.

Note: There are other files you need to backup but they should work fine in the GUI.



Friday, February 8, 2013

Copy files form VMware datastore with PowerCLI.



$input1 = read-host "enter"
Copy-DatastoreItem "vmstore:\\datacenter1\datastore1\*$input1*" c:\vmware\bkups -Recurse


I copy files from a datastore to my local PC on a regular basis. Of course you need to install PowerCLI on the local PC.

Monday, July 2, 2012

Simple script to clone a Vmware server.


I needed to clone a couple of virtual machines so I installed PowerCLI and created this small script. I can schedule this and have daily backups. I know cloning may not be the best form of backup but this is what I need today.

c:\>type clone.ps1
connect-viserver 10.1.2.3
remove-vm -deletefromdisk "vm1 - backup"
new-vm -name "vm1 - backup" -datastore ds1 -vm "vm1" -vmhost v01.example.com
disconnect-viserver
c:\>