VMWare ESX Server Admin Tips (What they don’t teach you in class!)
Unless you happen to be the developer, or involved in the code writing process it is rare that you will learn all the “undocumented features” of any given software. Such is the case for myself and one of the techs I manage involving VMWare’s ESX server product. The company we work for went completely virtual last year, and we were left with the headache of managing the new non-physical server farm and all it’s various issues. We both attended an instructor led VMware ESX admin class at Global Knowledge (given by VMWare) and have now worked with the product for a little over a year, yet we constantly find new ways to do routine maintenance tasks, and solutions to problems that are not covered in any class. In many cases we have discovered solutions that even Tech Support at VMware didn’t know about, or at the very least the lower level techs didn’t know about. Below are some TIPS we have discovered that we learned outside the classroom environment. Hopefully any of you reading these can be saved the time and effort we went through to find them.
Tip 1: Transfer files from server to your local machine.
You can use the SFTP protocol to connect to the ESX datastore. WinSCP was the 1st SFTP client I used to connect to our datastore, but later an awesome VMware tech (rare) told me about FastSCP. An SFTP client which was specifically designed to work with ESX server, and increases the transfer speed 10 fold. Think of BitTorrent for ESX Server. You can use this to transfer files between servers and your local machine for what ever reason.
Tip 2: Have a frozen VM?
Try the service mgmt-vmware restart
command. Just log into the Host where the VM lives via SSH, or with the console and enter the command. This might be a handy command if you are experiencing problems with your ESX host connecting to the VMware Virtual Center server. Also, if you having problems when kill -9
does not stop a VM guest OS.
Tip 3: VCB for all your local backup needs.
If you are trying to make a local backup of your VMs, there is a stupid simple way to do it. If you have the ESX_FULL_BACKUP license, this includes Consolidated Backup. With VMware Consolidated Backup (VCB) you can backup complete VMs without powering them off, or cloning, or any other “workaround”.
1st, download VCB from the VMware site.
Then install VCB onto your local machine. (Yes, the local machine)
Open a command prompt and navigate to the folder:
C:\Program Files\VMware\VMware Consolidated Backup Framework
Use the command as illustrated below.
vcbmounter -h <VMhost IP Address> -u <Username> -p <Password> -m nbd -a ipaddr:<VM IP address> -r <Destination> -t fullvm
You can even write .bat scripts and schedule them to run later.
If you DON’T have VCB then refer to Tip 1.
Tip 4: The incredible shrinking Virtual Disk.
It is often said that you can “grow” a Virtual Disk (VD), but you can not shrink it. Well thats not exactly true. If your VD is a non-system disk you have 2 options. 1st option is to transfer the data from one VD to another (or to a physical disk, see Tip 1). Delete the 1st VD, and make a new smaller VD to transfer the data back onto.
2nd option is to use the same method you would use to shrink a system disk. This method involves exporting the VM. Dont worry, you dont have to clone the entire VM, just the disk(s) you want to shrink.
In VIC (Virtual Infrastructure Client) power off the VM.
Right Click the VM you want to work with, and select Export…
Click Next
Click Select volumes and resize… Under New Disk Size you want to allocate enough space that you have a little room to grow, but not a while lot more than what is used. Once done, click Next.
Click Next again
Here you will choose the VMware Infrastructure Virtual Machine option then click Next
Enter in your ESX Servers IP, Username, and Password then click Next
Now name your new VM something very similar to the name of the existing VM (Your vmdk file will have this name) click Next 2 more times
Now choose your Datastore and hit Next again
In the network section, make sure you uncheck Connect at power on, then click Next (You wont be powering on the machine, this is just a safety precaution)
Click Next once more (You do not need VMware tools)
Click Next one last time
Then click Finish. (Make sure you DO NOT power on the VM)
Once the new machine is created go into the settings, remove the Hard Drive from the VM. Go into the datastore and move the VMDK file from the new folder to the original folder, and add the new drive to the original VM.
Tip 5: Orphaned Snapshot Removal.
Note: This does not work 100% of the time.
There comes a point in every VMs life where an orphaned snapshot will appear in its VM folder. No one knows why… errr well yes, there are many reasons why, but im not going over that right now.
Anyways, if you want to remove them, there are several ways to do it, but the fastest and easiest thing you should try 1st, is to take a snapshot, then “Delete All” snapshots. This simple quick task cleared out all of my orphaned snapshots… Give it a try!!