Resize an IDE drive in VMWare VSphere using Linux

I needed to increase the size of a hard drive in a Windows XP VM on VMWare VSphere ESXi 5, but discovered that VSphere does not support resizing IDE drives.

While it is possible to convert the drive to SCSI and then resize, that creates may render the drive un-bootable due to SCSI device drivers on XP.

I discovered an easier way, assuming you have a Linux VM available:

  1. Prepare XP for resizing
  2. a) run chkdsk /f and restart. This cleans up any minor disk corruption that may interfere with later steps.
    b) Stop your VM, then edit your XP VM settings. Add a new, larger drive to your VM. Choose “IDE” in advanced options. (If the VM is not stopped, you won’t see IDE as a choice)

  3. Temporarily give the drives to the Linux VM
  4. a) With XP stopped, edit the Linux VM to add two new drives, using the EXISTING XP drive images.
    b) As root on the linux box, run dmesg. You should see the new drives like this:


    [1087836.865331] vmw_pvscsi: msg: device added at scsi0:1:0
    [1087836.867284] scsi 2:0:1:0: Direct-Access VMware Virtual disk 1.0 PQ: 0 ANSI: 2
    [1087836.870663] sd 2:0:1:0: Attached scsi generic sg2 type 0
    [1087836.870904] sd 2:0:1:0: [sdb] 33554432 512-byte logical blocks: (17.1 GB/16.0 GiB)
    [1087885.031428] vmw_pvscsi: msg type: 0x0 - MSG RING: 6/5 (5)
    [1087885.031435] vmw_pvscsi: msg: device added at scsi0:2:0
    [1087885.031612] scsi 2:0:2:0: Direct-Access VMware Virtual disk 1.0 PQ: 0 ANSI: 2
    [1087885.031829] sd 2:0:2:0: [sdc] 16777216 512-byte logical blocks: (8.58 GB/8.00 GiB)

    You can see here that sdb is the new 16 gig drive, and sdc is the 8 gig drive.

  5. Use linux to migrate data and repartition
  6. a) as root on the linux box, run:
    dd if=/dev/sdX of=/dev/sdY &
    where X is the drive letter of your old drive, and Y is the drive letter of your new drive.
    BE CAREFUL NOT TO CONFUSE DRIVE LETTERS or you WILL destroy your data.

    b) You can check your progress periodically via:
    # pkill -USR1 dd
    465913+0 records in
    465913+0 records out
    238547456 bytes (239 MB) copied, 6.09248 s, 39.2 MB/s

    c) run gparted /dev/sdY to repartition your drive. Right-click resize, then click apply. (This step may fail if you skipped step 1a…)

  7. Finalize VM configuration
  8. a) Edit your Linux VM one last time, removing both XP drives
    b) Edit your XP VM and remove the old drive. Make sure the new drive is listed in IDE slot 0:0

  9. Restart windows
  10. a) Power up your XP VM. Say yes when Windows prompts you to reboot due to system updates.
    b) That’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *