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

Tuesday, 9 September 2014

Squeezing more from your Linux VMs

There is a way to squeeze a little more from Linux VM's.

The theory

Linux has a number of ways of sharing it's storage IO among different processes, the norm seems to be to use the Completely Fair Queuing (CFQ) scheduler which helps to prevent a single process from using more than it's fair share of storage IO. This is usually helpful in an environment where this one Linux box is the only OS using a storage device but when it is running on an hypervisor the hypervisor is also busy trying to dish out fair access to the storage so we are effectively doubling up calculating fair access. There are other schedulers that we can choose from and for VM's it seems to make the most sense to use either the noop or the deadline schedulers. They are both more simple to calculate then CFQ.

The practice

If you are using the device sda for your drive use the following to check what scheduler you are using :
# cat /sys/block/sda/queue/scheduler
which will return something like
noop anticipatory deadline [cfq]
Which indicates that the scheduler for this device is CFQ.

To change it on the fly you just: 
echo noop > /sys/block/sda/queue/scheduler
If you want to make the change work across reboots you will need to add elevator=noop to your kernel boot parameters, on a Debian system you edit /etc/default/grub and add "elevator=noop" to the GRUB_CMDLINE_LINUX line then run:
# update-grub
To update the grub configuration.

Sources: kb.vmware.com/kb/2011861http://serverfault.com/questions/360718/kvm-low-io-performance

Tuesday, 19 June 2012

Installing Windows 8 x64 Release Preview on an ESXI VM

I simply thought that it would be a case of installing Windows 8 release preview and I would be able to have a tinker. Unfortunately not.

Firstly make sure you are on ESXi 5.0 update1. Create a virtual machine and set the OS to "Microsoft Windows 8 (64-bit)". At the end of creating the VM, us the check box"open setting dialog"

In the VM's settings:
  • Change the video card to Auto detect settings and check the "Enable 3D support"
  • go to the Options->Boot Options and change the firmware to EFI
Now proceed with the installation of Windows 8 Release Preview and all should work.

I didn't modify the settings on the VM the first time I tried to install Windows 8 and ended up having to reinstall after making the above changes.

Thursday, 15 December 2011

Convert a Windows machine to a VMware VM with Clonezilla

I have had need to do manual conversions of physical and virtual machines for several reasons previously. Some of these reasons have included:
  • There is not enough free space on the machine's disk(s), (also know as "I haven't got time to wait for the machine's administrator to tidy up")
  • VMware Convert no longer supports the conversion of that operating system.
  • We can't afford PlateSpin
  • I wonder if I could do a conversion the hard way.
This takes me back to my first ESX Project. The company I worked for had about 8 test machines sitting along one office wall. The situation was already out of hand and I was being asked for more test machines. I decided we needed a to think big and decided on and got approved ESX on a couple of big (at least for us) servers to virtualise the test environment. I managed to simply move all the test machines by installing a fresh OS and installing and configuring all the software my self, with the help of the relevant departments. I then came to our Windows NT 4.0 software build machine.... No-one, not even the developer that put it together knew what was on there. We were building releases every couple of weeks at the time. It goes without saying this is not a good place to be, and baring a complete hardware failure on the physical machine there was no way anyone was going to be rebuilding the machine. I scratched my head and had previously used dd and tar to move installs from one machine to another on Linux, so I had a crack at it, and to my surprise a few hours later I had run a P2V by hand with a Linux live CD. I had even managed convince Windows NT to let me switch the drives from IDE to SCSI.

Having used Clonezilla to store a few images from machines that were shipped without restore media in the past, I wondered how easy it would be to back up an image of a machine and restore it into a new virtual environment. As it turns out with Clonezilla I don't even need to create an image, the tools are there to transfer the data from one machine's disk and write it directly to the disk of another.

The conversion here is from a Xenserver VM to a VMware VM but the technique used here will probably work else where. 
  • Put a Clonezilla live CD in both your (virtual) machines and boot them.
  • The default boot option for Clonezilla worked fine for me on both machines, your mileage may vary.
  • Select your language options as necessary
On the source machine:
  • Select "Start_Clonezilla"
  • Select "device-device"
  • Select "Beginner"
  • Select "disk_to_remote_disk"
  • Select "dhcp" or assign an IP address with "static"
  • Now it should show you a list of disks in the system, select the one you wish to transfer.
  • Select "Skip checking/repairing source file system" 
  • Clonezilla will now show you the command it is about to run, press "Enter."
  • You will be asked to confirm at a few important stages that you wish to proceed.
  • When you see "Waiting for the target machine to connect..." you have finished with the source machine for now, except take a note of the commands it is telling you run on the destination machine (See below image.)
On the destination machine:
  • Select "Enter_shell"
  • Select (2)
  • Type: sudo su - (to change to the root user)
  • Type: ocs-live-netcfg (and setup the networking)
  • Type: ocs-onthefly -s 192.168.1.1 -t sda  (replacing 192.168.1.1 and sda with the relevant IP address and device name)
  • You will again be asked to confirm at poignant stages.
You should see a progress bar which includes an estimate for the finish time.


When this finishes you should now be able to boot the destination VM and install the VMWare tools to make everything pretty and efficient. Don't forget to install the paravirtual SCSI and network card drivers if your OS is supported.


If you have success (or failure) with this migration method please leave a comment below, it certainly helped me out of a hole.

Thursday, 1 December 2011

Paravirtualizing vSphere guests

Although just setting up a virtual machine on a ESX server works well there are ways to improve the VM's performance and reduce some of the CPU overhead required when the VM interacts with the virtual hardware. The two ways I have used are installing paravirtualized drivers for network interface and for the storage controller.

Windows
If you are installing Windows from media or an ISO image:
  • Edit the VM settings, replace any networks adapters with ones that are of the type "VMXNET 3."
  • Change the SCSI controller type to "Paravirtual" 
  • On the floppy drive choose "use existing floppy image in datastore:", click browse, then find the relevant image in vmimages\floppies for your version of windows. Dont forget to "select connect at startup"
  • Hit F6 during the initial installation to add the paravirtual SCSI drivers from the floppy image. 
  • The OS wont recognise the network card until the VMware tools are installed.
If the VM is already set up and running Windows with VMware tools the drivers for the paravirtualised SCSI adapter are also installed with VMware tools but you will need to add a second SCSI adapter of the type "Paravirtual" and boot before Windows will be happy to with the first (boot) SCSI adapter being set to "Paravirtial."
  • Edit the VM settings, replace any networks adapters with ones that are of the type "VMXNET 3"
  • Using the Vshpere client Edit the settings of your Windows VM, Click the "Add..." button, choose "Hard Disk", Choose "Create a new Virtual disk" and set a small size like 8 MB.
  • If your VM already has a SCSI controller you will need to add an additional one. To get another controller you will need to choose a virtual device node which is from the second SCSI controller. I usually just select SCSI(1:0).
  • Check device manager to ensure the the PVSCSI controller has been detected.
  • Shutdown the VM, remove the hard drive you have just added and change the remaining SCSI adapter to type "Paravirtual"
  • Start the machine, if all is well (you will see a blue screen if it isn't) you will have successfully changed windows to use a more efficient way to talk to it's boot drive.
Converting IDE drives to SCSI
I struggled with Windows XP box that I had imported using VMware Converter that only had an IDE drive. I tried deleting the hard drive (I was careful not to delete the underlying files), then I went to add the hard drive and set it to SCSI it would only allow IDE. I overcame this by shutting down the virtual machine, editing the relevant .vmdk file and changing the ddb.adapterType parameter to lsilogic like so:
ddb.adapterType = "lsilogic"
You should now be able to add the hard drive back in specifying the existing .vmdk file and set the SCSI adapter to "Paravirtual"

Debian 6
On a system that is already running and the VMware tools are installed. I ran all updates and it was simply a case of removing the existing network adapter and adding a new one of the type "VMXNET 3" and changing the SCSI adapter to "Paravirtual" and everything worked.

Update: Also check out this post on changing the IO scheduler on linux VMs squeezing more from your Linux VMs

Wednesday, 10 August 2011

Installing VMware tools on a Debian machine

Update: You may not need to do this, check this post.

Another one for the list of things I forget how to do regularly.


Make sure our packages are up to date.

# apt-get update

# apt-get upgrade

Install the packages needed to install the vmware tools:

# apt-get install build-essential psmisc linux-headers-$(uname -r)

In the vmware server console select "Install VMWare tools..." from the VM menu.
Then type the following:
# cd

# mount /media/cdrom

# tar zxvf /media/cdrom/VMware*.tar.gz

# cd vmware-tools-distrib

# ./vmware-install.pl --default

That should be it, you should now have working vmware tools on your Debian distribution.

Optionally you can delete the installation files with:
# cd ..

# rm -rf vmware-tools-distrib


Update: You should consider using more efficient virtual hardware and drivers, check out my post about using paravirtualized drivers