Archive for June, 2009

Update to pvscsi on Linux

I just had top build a WebObjects VM using CentOS for our Dev team so had a chance to go over my instructions. The good news is that a 2nd hard disk is not necessary which makes the procedure a lot smoother. The instruction then, once you have the VM up and running and VMTools installed is:

# mkinitrd -f –with=pvscsi /boot/initrd-`uname -r` `uname -r`

Shutdown the VM. Go into Edit Settings and change the SCSI controller from LSI to Paravirtual. Save and Power up the VM. You should have success.

For an updated kernel, see my previous post.

Using pvscsi in Linux – Update

Well, after a bit of playing I will have to streamline my last post. But before I get to that, I figured out a way to build the pvscsi module into the latest kernel update BEFORE you have rebooted. (So you are able to reboot into the new kernel without a Kernel Panic).

My lasy example used kernel vmlinuz-2.6.18-128.el5. The lastest kernel update at the time of writing for Centos  5.3 was vmlinuz-2.6.18-128.1.14.el5. Its modules directory is located under /lib/modules/2.6.18-128.1.14.el5.  When the VMWare Tools are installed, it installs the relevant modules in /lib/modules/`uname -r`/misc. Where uname -r is the current running kernel. If we try make a ramdisk for initrd for the new kernel, we will get an error saying the modules are missing….which they are.

So here is my dodgy solution….

Create a misc directory in the new kernel’s module directory.  # mkdir /lib/modules/2.6.18-128.1.14.el5/misc

Copy the pvscsi.o file from the current kernel’s directory to the new one. # cp /lib/modules/2.6.18-128.el5/misc/pvscsi.o /lib/modules/2.6.18-128.1.14.el5/misc

Create a symlink in that directory for the kernel module.

# cd /lib/modules/2.6.18-128.1.14.el5/misc

# ln -s pvscsi.o pvscsi.ko

You should then be able to make the new initrd image with the new kernel. Ceck out the /etc/grub.conf config file to get the vewrsion number of the latest kernel. In my example, you would run:

# mkinitrd -f –with=pvscsi/boot/initrd-2.6.18-128.1.14.el5.img 2.6.18-128.1.14.el5

This should succeed. The -f flag means to overwrite the current file with that name.

Ok, reboot and you should be successful in booting off the new kernel with the pvscsi module. The re-run ‘’ as per normal to rebuild the the VMware Tools for this kernel. When it gets to pvscsi, it will ask to overwrite the current version. Select yes. You could remove this module before you run I have not tried that though.

Remember, this is not supported and YOU are responsible for any problem that may occur. I am not. Ok! Good.

It should work fine though.


Installing and using pvscsi in Red Hat and CentOS 5.3 under vSphere 4

Well, after reading a few blogs (I hate that word) on using the pvscsi adaptor under Windows 2003 and 2008 and converting the boot drive to use the pvscsi adaptor, I figured one for Linux was overdue. At the time of this post, only RHEL was supported. This also includes CentOS 5.3. So, it took me 10 minutes, but I worked out how to get Linux to boot from the pvscsi adaptor.

The process is this:

  1. Create CentOS 5.3 VM or use an existing one using the default LSI bus adaptor
  2. Install the latest VMTools.
  3. Add a new drive on a new adaptor. (ie Choose the SCSI ID of (SCSI 1:0) )
  4. Boot and format and install the 2nd drive
  5. Shutdown and change the 2nd drive adaptor to pvscsi
  6. Reboot and make sure the 2nd drive comes up. Check the module is loaded.
  7. Grab the module name.
  8. Create a new initrd for the kernel to boot up with including the pvscsi module.
  9. Shutdown, change the 1st Disk adaptor to pvscsi.
  10. Boot successfully, hopefully.
  11. Voila

Ok, here is the long version.

  1. Create your CentOS or Red Hat VM (I used version 5.3 at the time of writing)
  2. Boot into the OS. Install VMware Tools.
  3. Power down.
  4. Add a new Virtual disk in the Settings section. This will be a temporary drive. Give the Virtual disk a Device ID of SCSI (1:0). This ensures that a second scsi controller will also be added. Save the changes.
  5. Go back into Settings and choose the 2nd SCSI Controller that was just added. Change the Type to Paravirtual. Save and Exit.
  6. Boot the VM.
  7. Ensure the VM sees the new disk and the pvscsi module was loaded.
  • Run # fdisk -l to see the disks on the system. You should see /dev/sdb (the new drive)
  • Create and format the new drive
  • # fdisk /dev/sdb
  • ‘n’
  • ‘p’
  • ‘1’
  • Press Enter for the defaults
  • Press Enter for the defaults
  • ‘w’ to write the change

This will create the disk partition, /dev/sdb1. Format it with:

# mkfs.ext3 /dev/sdb1

Mount the new disk. Of course this is unnecessary but does help with testing and making sure stuff works.

If you could not mount the disk, something must have went wrong or my instructions are bad. Let me know.

Ok, but what about the first disk that the OS boots from? This is the think VMware does not support but it can easily be implemented. when the OS boots, grub reads a few settings from /boot/grub/grub.conf. The important things are the kernel and the initrd image. The kernel is self explanatory. The initrd stands for Initial ramdisk. This ramdisk is loaded at boot with a subset of modules required for the kernel to bootstap the system.  (Something like that…don’t quote me…). So, currently, the kernel knows nothing about the pvscsi module as we loaded it after the system was installed. If we changed the 1st SCSI controller to paravirtual, then the system would boot but the bork when it came time to mount the disks as it would not have found any as it had no disk controller…understand.   So how do we tell it about the new paravirtual disk controller?

You add it to the initrd so the kernel can then initialize the paravirtual SCSI controller and see the disk. How do you add the module?  Do the following:

  1. The VM is now up and running and you have successfully added a 2nd disk on the paravirtual controller. You can also see ‘pvscsi’, when you run, ‘# lsmod | grep pvscsi’.
  2. Create the new ramdisk as follows.
  3. Move the current initrd to a backup. (In my example, the kernel is /boot/vmlinuz-2.6.18-128.el5 and the corresponding initrd file is /boot/initrd-2.6.18-128.el5.img) Any new kernel that gets installed will have a corresponding initrd file installed as well and added to /etc/grub.conf.
  4. Rename the existing initrd. # mv /boot/initrd-2.6.18-128.el5.img /boot/initrd-2.6.18-128.el5.img.bak
  5. Make a new initrd with the same name but with the pvscsi module……..

# mkinitrd –with=pvscsi /boot/initrd-`uname -r`.img `uname -r`

That is the tilde sign, not a sigle quote. (`) Where `uname -r` returns the current kernel version, 2.6.18-128.el5.

Once the new initrd is in place and you have confirmed, (# ls -l /boot), shutdown the VM.

  1. Go into the Settings of the VM and change the Adaptor type of the 1st SCSI Controller to Paravirtual.
  2. Save and Exit.
  3. Boot and test.
  4. You should boot successfully. This means you have booted via the new paravirtual scsi controller.
  5. Hurrah

From then, do what you like. shutdown the VM, remove the 2nd disk, or keep the 2nd disk and place it on the first disk controller, the choice is yours. (Do that in the Setting pane by change Virtual ID from SCSI (1:0) to SCSI (0:1)).

Important things to take note of!

This is unsupported by VMware at the moment but works fine and VMotion does work fine as well. Whenever a kernel update gets released, please make sure to rebuild a new initrd image for the new kernel.

This can be a hassle. One way, would be to shutdown the VM, change the disk controller back to LSI Parallel. Boot, re-run to update the tools for the new kernel. The re-run the commands above to rebuild the initrd. then power off, change the controller back to paravirtual and reboot. That is the safest way.

Another way is to try build the modules for the new kernel and build a new initrd. I have to work on how to do that so look out for another post.

Another pvscsi link for Windows

Here is another URL to guide you into pvscsi glory. GLORY!!!!!


Implementing pvscsi in Windows 2003 and windows 2008 on vSphere 4

I found a great URL on how to update an ESX 3.5 VM to vSphere 4 (ESX 4) and also incorporate the new pvscsi I/O adaptor for the root drive (C: drive).

Now I just have to find it…….

Here is the link to Scott Lowe’s excellent blog…. I’m not sure if this is the exact page I read but it has the same instructions.

IMPORTANT!! VMWare do not support the pvscsi adaptor for the boot drive….they do not support it……important words…does not mean it does not work. For years, they did not support Storage Vmotion on iscsi and nfs …does not mean it did not work. You have been warned. END COMMUNICATION

Hello world! Pants Off!

This will be a blog for handy tips and our way of giving something back to the Interweb after taking so, so much from it. 😀