Wednesday, February 20, 2008

Intalling VMware tools in linux when guest CD doesn't mount

Incase you can't get the VMware tools install mounted as cdrom using the Virtual Center GUI, there is a easy workaround you can use.
From the guest virtual machine, sftp to the ESX server host and for default install paths go to /vmimages/tools-isoimages.
Get linux.iso from here and quit from sftp.
On the guest linux, su and then create a tmp folder(or whatever you want to call it).
mkdir tmp
Mount the iso by using the following command:
mount -o loop linux.iso tmp
then you can "cd tmp"
Run the rpm installer from here and for other linux, copy the .gz file to your home folder.
From their you should be able to install the vmware tools.

Friday, February 15, 2008

Extend the windows disk under VMware

Few of the earlier windows installations we did with 5G or 10G OS partition started filling up and we constantly needed to juggle files around to keep it alive.
There is option available though to extend these disks, as long as the disks are basic disks and not dynamic disks(I haven't tried working with dynamic disks yet).
Another thing, there are other methods available to do the same also like using other disk partition software or ny using VMware converter, please evaluate what best suites your needs.
What would you need:
1. Downtime for the virtual machine which needs its disk extended.
2. Another Windows 2003 server virtual machine(on same vmware host or able to see the disk of 1st virtual machine) which you can power off twice.
3. ssh or telnet to the vmware esx host server.

Basically, it requires following steps:
1. Shutdown the virtual machine whose disk has to be extended.
2. Increase the disk size by ssh(or telnet) to vmware server host and using the vmkfstools command.
3. Present the disk to another Windows 2003 virtual machine.
4. Extend the disk in question.
5. Shut down the extending machine, remove the disk from this machine's resources.
6. Boot up your virtual machine in question and you should have an OS drive with more space now.
Please make sure you do a backup of the original file incase something doesn't go as expected.
Lets dive deep into these steps now:
1. Shutdown the Virtual machine in question: You have to schedule downtime for the virtual machine to extend its disk.
2. Login to vmware esx server using ssh(or telnet), whatever you use.
Issue the following command to extend the disk in question:
vmkfstools -X 15g /path/VMtest.vmdk
Replace 15g with whatever the new size you want, 10g, 20g etc.
and /path/VMtest.vmdk with the full path and vmdk file name for that host.
(Should be under /vmfs/volumes/[storage_name]/[Virtual Machine Name]/)
3. Through the virtual center now, Shut down the Windows 2003 server we are going to use to extend the disk in question. Edit settings > Click on Add, then Hard Disk, Next, Use and existing disk, Browse to the disk in question and add this. After this disk shows up the resources(or hardware), boot up this machine.
4. Through the disk manager, you should be able to see this new disk with new unpartitioned disk space. Go to command line and enter diskpart.exe.
On the prompt, type list disks.
Select the disk in question by using select disk 2, for example.
Then type List volumes and it would show you all the volumes. select the volume in question by using select volume 1, for example.
Now type "extend". This would extend the volume.
Disk Manager, should show you the disk now with extended capacity.
5. Now shut down this server, Edit settings again and remove this disk(do not delete)
6. Boot up the original virtual machine now and you should have an extended OS disk now.

Wednesday, February 13, 2008

ESX trunking Server Side

In continuation of my last post:VMware ESX VLAN trunking I had a issue on one of the server where service console was not on a separate NIC and hence after trunking I couldn't get to it remotely via Virtual Center or ssh.
So basically, I had to use command line utilities on local console to get the service console back on network before I could create port groups for different vlans and attach my virtual servers to these. Here is how I went about doing this:
Login to ESX server as root and issue the following command:
esxcfg-vswitch -l
This command is mostly under /usr/sbin and Gives me list of currently configured port groups, their Now lets assume that service console port is under vlan 25 for vswitch0, so we would need to create a port group for that vlan and lets call it "SCVlan25", could be anything you want to call it.
So to create this new port group, issue the following commands:
Add the new port group:
esxcfg-vswitch --add-pg=SCVlan25 vSwitch0
Add it to required vlan:
esxcfg-vswitch --pg=SCVlan25 --vlan=25 vSwitch0
Now, esxcfg-vswitch -l
This would show you the added port group.

Next step is to add the service console port under this newly created port group.
Use the following command to get the listing:
esxcfg-vswif -l
Now, you would get the name of the interface from
this command, in my case it was vswif0.
Following command would be issued to put it in the right port-group:
esxcfg-vswif vswif0 -p SCVlan25
then again, "esxcfg-vswif -l" to confirm it.

Now your service console should be on the network. And you should be able to create other port groups using command line above or the Virtual Center as mentioned in the earlier post.

Another issue I ran into is that after deleting a virtual switch so that I can team the physical NICs, the other virtual switch would not show the physical NIC I wanted to add, in virtual center.
So this had to be done via command line also:
esxcfg-vswitch -L vmnic# vSwitch#
where vmnic# would be replaced by whatever NIC you want to add to that particular vswitch#.

Monday, February 11, 2008

VMware ESX VLAN trunking

We had been running VMWare ESX servers for a while without any VLAN trunking. This means, each physical NIC was part of a separate VLAN and this led to no network teaming(hence no failover) as number of NICs were be limited.
Another limitation was that we couldn't add any more VLANs as all the NICs were already used. This is when we decided its better use trunking in our environment. I got my start from following website for Cisco IOS configs:
ESX Server, NIC Teaming, and VLAN Trunking
This worked fine for the server on switches running Cisco IOS.
But since we are running some switches in hybrid config with CatOS, the following steps were taken on those switches for ESX server to work in trunking mode:

1. If you haven't created a native VLAN for ESX environment now, you would need to create that with following command:
set vlan "vlan-id" name "name"
"vlan-id" here is the vlan number you want to assign this new vlan and could be anything between normal range 1–1000 and extended range 1025–4096.
name doesn't have to specified but makes it easy to see what vlan is what.

2. Change the port to trunking mode:
set trunk "mod/port" on dot1q
or
set trunk "mod/port" on dot1q "vlan numbers"
depending on whether you want to allow all VLANs or certain VLANs on the port.

3. Set the native vlan on the port:
By default vlan 1 is the native vlan, to change it:
set vlan "vlan-id" "mod/port"
where "vlan-id" is the vlan number created in step 1 or the vlan number if it already exists in your network.

Now, on the ESX server side:
From the virtual center, go to configuration for the host and click on networking.
Then Add Networking, Choose Virtual Machine, choose the vswitch with the NIC(s), choose the name you want to call it and "vlan-id" for that port group.
You can repeat the same steps for whatever vlans you want to configure on the host.
After that you can Edit the settings for the Virtual Machine to point to their respective port-groups and should be good to go.