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 vmware-config-tools.pl 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.