Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Move a VirtualBox VM's VDI File
- Background
- Sometimes things get a little OCD in my brain and I suddenly realize a better way to organize the vast numbers of files stored on my various disk drives. This happened recently with my Virtual Machines (VMs). It started with wanting to move my Virtual Disk Image (VDI) files to a new partition. First off, moving a VM is pretty easy if you move the entire folder it is created in, and the VDI(s) were all in that folder or some relative location that was moved also. But just relocating a VDI can be tricky if you don't know that VirtualBox keeps a record of all your media in it's global Virtual Media Manager. That tidbit may be enough to send you on your way, if not then read on.
- Walkthrough
- In this example our host OS is Windows 7 and we start out with a folder named D:\VM that we want to be the parent folder of all our VMs and VDIs. Our VM is called botus and is located at D:\VM\botus. Unfortunately the VDI is in D:\VM and I want it to be in D:\VM\botus.
- The first thing to do is make sure the VM is not running and then find the VDI file and move it to the new location. Make a backup.
- Now open the VM's settings and navigate to the Storage settings. Select the VDI file and then click the "remove attachment" button (circled in red below).
- If you were to try and add the VDI now it would result in an error. By the way, select the "Controller: IDE" node to enable the "add new attachment: button (the disk with a plus sign).
- Cannot register the hard disk because a hard disk with UUID already exists.
- So don't add the VDI file yet. Click the OK button to close the settings dialog.
- Open the VirtualBox Manager's File menu and find the "Virtual Media Manager" menu item. The default shortcut on Win7 is Ctrl-D.
- Now, if you still have a copy of the VDI in the original location and didn't remove it as an attached drive, you will first have to release the drive. Select the VDI file and click the Release button. You could have also just done this here, rather than doing it from the VM's settings.
- Select the VDI file from the list and then click the Remove button.
- You may (depending on your settings) get this dialog. Click the Remove button.
- You may also get this dialog, which would happen if you left a copy of the VDI file in the original location. Be sure to click the Keep button if you don't want the file deleted permanently.
- Close the Virtual Media Manager by clicking the Close button.
- Go back to the VM's settings dialog and navigate to Storage. Click the add attachment button (floppy disk with plus sign) and then select "Add Hard Disk".
- A dialog asking if you want to create a new image or use an existing one will open. Click the "Choose existing disc" button. Browse to and select the new location of your VDI file. Click the Open button in the file browser to close it.
- That's all. Close the settings and run your VM.
- http://programmingaddict.blogspot.com/2014/02/move-virtualbox-vms-vdi-file.html
Advertisement
Add Comment
Please, Sign In to add comment