Code: Select all
VBoxManager --moveDir dirOld dirNew.
This is the way I did it and probably was the hard way!
1. Create a separate partition on your hard drive. I used the LiveCD PartedMagic 3.1 I sized it generously. HD's are relatively cheap these days. You might need as much as 10 GB per VM (or more)
2. Add an entry to /etc/fstab so the new partition (/dev/sda6 in my case) is mounted as /vm. My entry looks like
Code: Select all
# Added by LJ to mount /dev/sda6 as /vm. Note all VMs for virtualbox reside in this partition.
# /dev/sda6
UUID=f597569c-cc5b-4738-86b7-3c1a6fa7e969 /vm ext3 relatime 0 2
Code: Select all
ls -al /dev/disk/by-uuidNow reboot and verify that you have an empty /vm directory. Check it's size. Should be MANY gigabytes. Mine was 18 GB.lrwxrwxrwx 1 root root 10 2008-11-11 14:12 f597569c-cc5b-4738-86b7-3c1a6fa7e969 -> ../../sda6
4. Create the destination directory in your new /vm directory
Code: Select all
mkdir /vm/.VirtualBoxCode: Select all
cp -r /home/lj/.VirtualBox/* /vm/.VirtualBox6. Change to the old .VirtualBox directory (in my case this is /home/lj/.VirtualBox)
In there, find the file VirtualBox.xml. Rename it VirtualBox.xml.original for safe keeping.
Code: Select all
mv /home/lj/.VirtualBox/VirtualBox.xml /home/lj/.VirtualBox/VirtualBox.xml.originalIn there find the Machines directory. In the Machines directory descent into one of your Virtual Machine directories. In it, find the file with the extension of .xml. Rename it *.xml.original. Something similar to
Code: Select all
mv /vm/.VirtualBox/Machines/Kubuntu_8.04/Kubuntu_8.04.xml /vm/.VirtualBox/Machines/Kubuntu_8.04/Kubuntu_8.04.xml.original9. Click New -> Next in the Name textedit enter the directory where you virtual machine is stored. Here I entered "Kubuntu_8.04". I then selected Ubuntu as the OS Type. Click Next and Next again. Click Existing then the Add from the Virtual Disk Manager gui. Find the .vdi assoicated with this machine. Here I selected Kubuntu-8.04.vdi from the /vm/VirtualBox/VDI directory. Click Open. Kubuntu-8.04.vid should be highlighted. Click Select. Click Next. Click Finish.
Obviously, if your VM is XP, then the OS type will be XP, not Ubuntu.
10. With any luck, Kubuntu_8.04 should be appear in the VirtualBox gui list and run when you click Start.
11.To verify the move was successful, rename your /home/lj/.VirtualBox/VDI directory to /home/lj/.VirtualBox/VDI.old. If you can still run your VM's from the VirtualBox Gui, then you can safely think about deleting the Machines and VDI directorie located in your original .VirtualBox directory (not the new one in /vm!!).