Menu

How-To

Matt
  1. Before running this script, you must ensure that you have enable SSH access on your ESXi server, this is disabled by default. To enable SSH access, follow the guide provided by VMware found here: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1017910
  2. After downloading the script (and installing the necessary Perl modules), there will be a single Perl script for you to run. Ensure that you have execute permission on the script and simply run it by typing “perl esximager.pl”
  3. You will be presented with a series of prompts asking you to enter the IP address, username, and password of the ESXi server you wish to connect to. This will be the server that runs the virtual machines that you wish to image
  4. Next the script will find any file with a .vmx extension. Because a .vmx file is unique to each virtual machine, this essentially finds all the virtual machines that are stored on the ESXi server. The user is then prompted which virtual machines they would like to image. Multiple virtual machines can be specified using a comma separated list. The script will then ask you to confirm your selection.
  5. The next step involves selecting which particular files of each virtual machine you specified above you with to image. Again, multiple values can be specified using a comma separated list. If you are unsure what each file type is, take a look at this document provided by VMware: http://www.vmware.com/support/ws5/doc/ws_learning_files_in_a_vm.html
  6. The next prompt asks the user where on their local computer they wish to store the images. The script will attempt to create the directory if it does no already exist. All images copied from the ESXi server will be stored in this directory
  7. This script utilizes netcat and dd to copy the files from the ESXi server to your local computer. You must tell netcat what port to use.
  8. The user is also prompted with what ip address they wish to use this is again used for creating the netcat session. If you do not have multiple nic’s in your computer, you are going to want the ip address under eth0
  9. Once you enter the last prompt above, the script will then copy all of the file types from each of the virtual machines that you specified earlier in the script. These files will first be hashed on the server, copied over the network using dd and netcat, stored in the directory you specified, and hashed again to ensure image integrity

Related

Wiki: Home

MongoDB Logo MongoDB