Mount broken .vdi VirtualBox disk image

Assume a VirtualBox guest OS Windows 10 VDI disk image mydisk.vdi that you wish to mount without Virtualbox, perhaps because your guest OS crashed. Here’s how to rescue files from a crashed VirtualBox VDI.

VDI rescue disk space required

The disk space used by the cloned .img file will be the full expanded size of the dynamic partition if one was used. So if your dynamic partition max size was 100 GB but only 10 GB was used, the clone operation will still use the full 100 GB.

Rescue files from VDI

  1. copy the VDI to IMG format
   VBoxManage clonehd --format RAW mydisk.vdi mydisk.img

   cd ~/"Virtualbox VMs/Windows 10"
   
  1. Examine partition
   parted mydisk.img  #not sudo
    
   unit
   B
   print
   

look for the “start” column for the biggest partition, that’s probably the virtual machine. 3. If you chose “12345 B”:

   mount -t ntfs -o loop,ro,offset=12345 mydisk.img /mnt
   

It takes several minutes to unpack. 4. Explore the files in /mnt as usual. Copy out what you need.