Expanding an VirtualBox XP system disk

Written by  on September 1, 2010

After spending an extraordinary amount of time trying to figure out why I couldn’t get NTFSResize to work, I finally found Seppe vanden Broucke’s log entry. For posterity, I’ll record what I did, here, following partly the instructions in the original post and one commenter’s modification:

  1. Get the SysRescCD ISO image. (Any live linux CD should work, including Knoppix.)
  2. Create a new (larger) VirtualBox disk image (*.vdi) from within VirtualBox.
  3. In the VirtualBox Details tab for your Windows instance, set your original VDI as the IDE Primary Master.
  4. Set the new (empty) VDI as the IDE Primary Slave.
  5. And set the linux ISO as the CD/DVD IDE Secondary Master.
  6. Ensure that the instance is set to boot from the CD/DVD first in System->Boot Order.
  7. Boot the instance.
  8. At the command line, run
    fdisk -l /dev/sda
    You should see a partition there of type 7, NTFS.
  9. Then run
    fdisk -l /dev/sdb
    You should see an error message that says there is no partition on that device.
  10. Then run the command:
    dd if=/dev/sda of=/dev/sdb
    This will take a long time. It means copy from the input file /dev/sda to the output file /dev/sdb.
  11. Shutdown the system with:
    shutdown -h now
  12. Change the Storage->IDE Secondary Master (CD/DVD) from the ISO image to your regular optical drive, or remove it completely so that it will boot into the original (small) Windows image.
  13. In Windows, select Start->Run… and type:
    diskpart.exe
  14. Type:
    select disk 1
    to select the (large) disk.
  15. Type:
    list disk
    to see that you’ve selected the right one with the right size.
  16. Type:
    select partition 1
    to select the 1st partition on that disk.
  17. Type:
    list partition
    to see that you’ve selected the right partition.
  18. Type:
    extend
    to extend the volume all the way to the end of the device.
  19. Turn off the virtual instance and select the new (larger) VDI as the Storage->IDE Primary Master.
  20. Boot the instance again and you should have a larger system (C:) disk.