Tuesday, September 9, 2008

Moving VM's in VMware ESXi via SSH

VMware ESXi is a great product but it present's a number of challenges because of its highly streamlined feature set. Lets say for example you need to move a VM from one VMware server to another and don't have an NFS server or iSCSI target. And of course you don't have any of the licensed features like Backup or Vmotion either. Lets add another challenge that you only have SSH access to the system. Sounds like a fun challenge already.

Our first challenge of course is SSH access to VMware ESXi. ESXi is considered an "appliance" by VMware and SSH and their CLI have been removed. Enabling SSH is trivial and can be done by pressing ALT F1 at the console and typing unsupported and then the root password of the machine. From there uncommenting ssh in /etc/inetd.conf and restarting services with a /sbin/services.sh restart will get inbound SSH to the box. You will also need to do this on the system you are trying to move your VM to. Word of caution VMware does not support this and there are security implications to enabling SSH on ESXi. You should evaluate the risks in your environment beforehand. ESX has a SSH interface by default but there is the "warning" message within ESXi.

From there you can navigate to the vmx and vmdk files you wish to migrate under the /vmfs directory. Your VM's should be under /vmfs/volume/yourdatastorename. Once you are in the directory you wish to migrate you can use SCP to copy the physical disk files to the other machine. With a command similar to scp * root@hostname:/vmfs/volumes/datastorename/vm-dir.

On VMware ESXi the command line features of regular ESX have been removed. You will need to install the "Remote Command Line Tools" either on a linux host somewhere on your network. You will need the specific command vmware-cmd for the registration of the VM with the hypervisor and to power on the VM. Download the Remote Command Line reference guide for more information on the CLI. A command similar to vmware-cmd -H hostname_of_hypervisor -s register /vmfs/volumes/datastorename/vm-dir/vm.vmx datacenter-name resource-pool.

Now that our VM has been moved and registered we are ready to boot it. You can do this from the remote command line with vmware-cmd -H hostname_of_hypervisor /vmfs/volumes/datastorename/vm-dir/vm.vmx start

Saturday, September 6, 2008

Fun With Fibre Revisited

Today my new toy arrived. I ordered an EMC Connectrix DS-8 fibre switch to retire my dual Sun Vixel Rapport FC-AL hubs. Under the covers its really a Brocade Silkworm 2400 with EMC badging. Brocade sells their switches rebadged for a number of other vendors including IBM and you can snap the "badged" switches up for next to nothing. I initially planned on a Silkworm 2800 or EMC DS-16 for more ports but got a steal of a deal on the smaller configuration. For my home tinkering it will do just fine.

Configuration was amazingly simple and can be done through the Java driven web gui or the command line. The command line is straight forward but a bit "funky" for people who are more used to Cisco or Foundry style CLI's. As with any CLI the help function is quite useful for figuring out the syntax of commands. The Java driven GUI as expected only works well with IE on windows which was not unexpected. The GUI is actually pretty useful as well and is good for quick status info and keeping tabs on the switch.

Impressively enough OpenNMS found the swtich via SNMP and is able to pull graph data from it without having to do any extra configuration. It will be great to be able to keep tabs on what's up on the SAN without having to log into the switch directly.