Convert VMDK to VDI and Enlarge C: on Windows XP Virtual Machine

Get some information on the…

Login

Blog History

Get some information on the VMDK you are going to convert

VBoxManage showhdinfo Windows\ XP\ Professional\ 2.vmdk

VBoxManage showhdinfo Windows\ XP\ Professional\ 2.vmdk
UUID: 880b32c8-db80-4caf-94d4-f7af29b691d3
Accessible: yes
Logical size: 10240 MBytes
Current size on disk: 10240 MBytes
Type: normal (base)
Storage format: VMDK
Format variant: fixed split2G
In use by VMs: Windows XP Pro 10GB (UUID: 66041cc2-a2c6-4e92-bd9d-ccdc0f166f5c)
Location: /mnt/2TB_VOL2/Virtual Machines/Windows XP Pro 10GB/Windows XP Professional 2.vmdk

Using VBoxManage convert the VMDK to a VDI image.

VBoxManage clonehd Windows\ XP\ Professional\ 2.vmdk winxppro10gb.vdi --format VDI
# note I made the mistake of naming my VMWare vmdk file with spaces which makes it harder to run command line programs
# Don't give your VM's spaces in their names!

Enlarge the VDI file

VBoxManage modifyhd winxppro10gb.vdi --resize 40960
# resize virtual hard drive

Mount the VDI file in a GNU/Linux VM and delete and resize the partition

I next used a Fedora 17 live ISO and created a Virtualbox VM, added the resized vdi file to it as secondary hard drive and booted from the live CD into Fedora 17.

Then get root in F17 and

fdisk -l
# list your fixed disks and make note of the start sectors
fdisk /dev/sdb

# delete the partition
# I ran into a problem here the start sector was 63 and
# F17 fdisk wouldn't allow me to recreate the partition at a start of 63 only 2048
# restarted using the -c option and I was allow to create a start of 63
fdisk -c=dos /dev/sdb

# remember once you have 'd' deleted and recreated 'n' the larger partition
# you need to mark it as active 'a' and label it 't' as NTFS (7).

# write 'w' the new partition to disk.

# run ntfresize
ntfsresize /dev/sdb1

# by default this expands the ntfs to the full size of the partition

# so you don't need other options other than the partition device name

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.