Recently I lost everything on my PC and reinstalled Windows. But I have my old Ubuntu virtual machine's .vdi file.

Can I make a virtual machine with that .vdi file? If so, how?


If you are using VirtualBox, then it is not too difficult to take a VDI and use it anywhere. Here's how:

  • copy your .vdi file to a directory where VirtualBox will be able to access it
  • run VirtualBox and create a new virtual machine
  • choose Ubuntu Linux as the operating system and click "Next"
  • under the "Virtual Hard Disk" option, choose "Use existing hard disk". This will open the "Virtual Media Manager".
  • in the Virtual Media Manager, click the "Add" button and select the .vdi file that you copied, then click "Next"
  • configure the rest of the virtual machine as you would like it to be
  • start the virtual machine

So long as the .vdi file has not been corrupted, it will work just fine.

  • 1
    Well written. +1 Apr 27 at 8:10
  • I got an error when adding .vdi file 'Could not get the storage format of the medium 'C:\Users\NO-NAME\VirtualBox VMs\Ubuntu.vdi' (VERR_NOT_SUPPORTED).' Apr 27 at 9:38

Convert VDI File to Full Install

You also have the option to convert a .vdi file to an .img file and flash that to HDD or USB.

  • Log into Ubuntu.

  • Open VirtualBox

  • cd to folder that contains ubuntu.vdi and run:

VBoxManage clonemedium --format RAW ubuntu.vdi ubuntu.img

This will create the Ubuntu image file

Install Image File to target drive

Caution: The target drive will be overwritten.

  • Use Gnome-Disks, Etcher, Rufus, dd or mkusb when you want to restore or clone the image to another HDD or USB drive.

For using Etcher or Rufus to flash an image to HDD see: https://askubuntu.com/a/1333112/43926

  • with this can't I make a new virtual machine Apr 27 at 9:39
  • @Aesha Amoli: This answer is to give you an option to be able to run your old virtual machine from a USB or from a HDD. matigo's answer is the one you asked for, mine is just an option. Apr 27 at 9:47
  • ohk then i have to live boot it and get all deleted files, am i right? btw 'VBoxManage clonemedium --format RAW ubuntu.vdi ubuntu.img' isn't working on cmd Apr 27 at 10:04
  • Are you running it from within the folder that has the .vdi file? "ubuntu.img" should be changed to the name of your image file Apr 27 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.