Converting vmware disks from IDE to SCSI

In the process of moving from VMWare Server to VMWare ESXi I realized I must change the layout of my disks. ESXi doesn’t like growing disks, nor does it like IDE disks.

I alluded to my initial conversion issues in this post. While I learned more than I asked for, it seems it wasn’t quite necessary to use the lsilogic adapter. Buslogic worked just as fine…

First, credit where credit is due. I gathered all my information from http://hamed.dk/home/53-vm-ide2scsi and http://blog.creonfx.com/linux/howto-convert-vmware-windows-xp-ide-disk-to-lsilogic-scsi.

Having converted a couple of disks, I felt obliged to add the minor details I managed to add to the process.

Not that I’m a sissy, but one never knows. Close the virtual machine and backup!

  1. cd /VMs
  2. $ mkdir backup
  3. $ cp -v virtualmach1/* backup

My disks hadn’t been defragmented in a while – as I didn’t even know that was possible, so lets start doing that:

  1. $ cd /VMs/virtualmach1
  2. $ vmware-vdiskmanager -d Windows\ XP\ Professional-cl1-000001-cl1.vmdk
  3. Using log file /tmp/vmware-root/vdiskmanager.log
  4. Defragment: 100% done.
  5. Defragmentation completed successfully.

When I read the other posts, I was quite worried about not having a “small vmdk-file” that contained the disk description. Fear not! It will magically appear after the next step: Disk conversion. While we’re at it, give the disk a better name. Delete the old disk. We have a backup, remember?

  1. $ vmware-vdiskmanager -r Windows\ XP\ Professional-cl1-000001-cl1.vmdk -t 2 virtualmachine1.vmdk
  2. Using log file /tmp/vmware-root/vdiskmanager.log
  3. Creating monolithic preallocated disk ‘virtualmachine1.vmdk’
  4.   Convert: 100% done.
  5. Virtual disk conversion successful.
  6. $ ls *.vmdk
  7. virtualmachine1-flat.vmdk  virtualmachine1.vmdk Windows XP Professional-cl1-000001-cl1.vmdk
  8. $ rm "Windows XP Professional-cl1-000001-cl1.vmdk"

The virtual physical layout of the disks will change when we convert it to a SCSI disk, but the number of sectors remain the same. Check the number of sectors you have now:

  1. $  cat virtualmachine1.vmdk|grep RW| awk  ’{print $2}’
  2. 25165824

The number 25165824 will be used to create a dummy SCSI disk. YOUR NUMBER WILL NOT BE THE SAME!

  1. $ vmware-vdiskmanager -c -s 25165824 -a buslogic -t 1 scsi.vmdk

If you’re like me and prefer to copy entire lines and avoid remembering numbers between screens, here goes:

  1. $ vmware-vdiskmanager -c -s `cat virtualmachine1.vmdk|grep RW| awk  ’{print $2}’` -a buslogic -t 1 scsi.vmdk

Either way, look at the scsi.vmdk file and copy the lines the look similar to

  1. ddb.geometry.cylinders = "1566"
  2. ddb.geometry.heads = "255"
  3. ddb.geometry.sectors = "63"
  4. ddb.adapterType = "buslogic"

Open virtualmachine1.vmdk and replace the lines that have the same keys.

Now we need to make some changes to the vmx-file. The vmx-files don’t seem to care about the order of values. My file was hard to navigate in, as keys were not collated. To the rescue:

  1. $ cat winxppro.vmx | grep  "\#\!"  > w.vmx
  2. $ cat winxppro.vmx | grep  -v "\#\!" | grep -v "^$" | sort >> w.vmx
  3. $ chmod w.vmx –reference=winxppro.vmx
  4. $ rm winxppro.vmx
  5. $ mv w.vmx winxppro.vmx

Edit the vmx-file and remove/comment out the ide0:0* keys.

  1. #ide0:0.fileName = "Windows XP Professional-cl1-000001-cl1.vmdk"
  2. #ide0:0.present = "TRUE"
  3. #ide0:0.redo = ""

Find the section mentioning scsi, or place it in the correct alphabetical place:

  1. scsi0.present = "TRUE"
  2. scsi0.virtualDev = "buslogic"
  3. scsi0:0.present = "TRUE"
  4. scsi0:0.fileName = "virtualmachine1.vmdk"
  5. scsi0:0.mode = "independent-persistent"

I already had the key ’scsi0.present = “TRUE”‘ present. Having the key twice prevents the machine from starting!

If you changed names on the vmx-file, remove the old machine from the inventory in VMWare server console. Open the new vmx-file. Start it.

Important: If you did rename the files, you will get a question if you want to keep or replace the identifier. Most likely you want to KEEP the identifier. After all it is the same machine.

If everything worked as expected, delete the backup directory. You can also delete scsi.* from your VM directory. If it didn’t work out – restore the directory, start from top of page and read more carefully.

–Jesper Hogstrom

  • Share/Bookmark

Leave a comment

Your comment