Archive for February, 2008

Linux Software Raid + VMware

Posted: February 22, 2008 in Linux, VMware

In my previous entry, I wrote about the problem I faced with VMware using SCSI as the virtual disk emulation. After a few experiment, I notice, the problem only exist in my Linux that uses software raid. All of my 3 machines that hosts VMware are using software raid mirror. I tried with one machine without software raid, the default SCSI virtual disk works fine, even in I/O high load.

I had mentioned this in one of my response to the comments I received. So far, I notice, in software raid setup, Linux run best with IDE as the virtual disk emulation. Below are the steps taken by me to convert the SCSI disk to IDE disk. The steps are quite simple, so far no lost data or guest OS failure encountered. However, I am using Slackware, which uses lilo as the OS loader. So, this little guide only applicable to Linux that uses lilo.

  • Step 1: Delete the Virtual SCSI disk and remove SCSI from the system – This may sound like a very drastic measure, but removing SCSI disk does not destroy the virtual disk images. This can be done by doing: Edit Virtual Machine Settings -> Select the SCSI disk -> Press the “Remove” button
  • Step 2: Edit the .vmx file and .vmdk file of the guest OS – For example, in my guest OS, Linux, it will have a Linux.vmx file. Inside this file would contain the following entries:
    scsi0.present = "TRUE"
    scsi0.virtualDev = "lsilogic"

    Set the “TRUE” to “FALSE” and remove the scsi0.virtualDev line. After this, edit the Linux.vmdk file, and change:
    ddb.adapterType = "lsilogic" to ddb.adapterType = "ide"
  • Step 3: Add the modify virtual disk image – Goto Edit virtual machine settings again, this time use Add to add a new disk, and make sure we select Use an existing disk and browse the the modified Linux.vmdk that we had done in step 2.
  • Step 4: Make the guest OS boot from hda instead of sda – First, use the Slackware installer CD or ISO image to boot up. After boot up the system using the installer disk, mount the virtual disk partition to /mnt. From here, edit /etc/lilo.conf and /etc/fstab, make sure we change all the entry of sda to hda. Once this is done, run ‘lilo -r /mnt’. Create the hda* device file in /mnt/dev if required.

Once we reached here, we can remove the CD installer or ISO image from the guest OS and let it start as per normal.

I had converted many guest OS systems using the steps mention, it works quite well and it took not longer than 10 minutes to finish.

However, I am using Slackware, so these steps are typically for Slackware. For other distro, we will need to know how to manually make a partition bootable. This is very important! Else we won’t be able to boot up the disk image we had modified

Lastly, (though it may seems obvious to some) do remember to try these steps with a few test guest OS before actually apply to a production guest OS. We should backup the production guest OS just in case something went wrong.