Can I migrate a VirtualBox Ubuntu Guest to a *real* Hardware Box?

I want to transfer Ubuntu from a VirtualBox Guest 'appliance' to a real (metal and chips) computer?

Can this be done, and what steps are involved?


I'd try it with dd (don't forget to replace the device names like sda with your device name):

  1. Replace all uuids in your /etc/fstab with things like /dev/sda1 (sda = destination hd number!)
  2. update-grub2 && grub-install /dev/sda
  3. Save your virtual hdd inside VBox into a File: dd if=/dev/sda /home/user/sda.img
  4. Copy the Image to a disk (external hdd, network share, dvd, ...)
  5. Restore the Image to the destination drive: dd if=/media/drive/sda.img of=/dev/sda

The biggest problem might be the bootloader (but there are tutorials for this even in this forum). I once reinstalled a bootloader by doing a fresh install of Ubuntu (preferably the same as the one you dd'ed) and then dd the old partition over the fresh install (in this case, you would only dd /dev/sda1, not /dev/sda, which also includes the bootloader and all partitions)


Haven't tried this myself, but description seems to be realistic enough to try.


1> do a tar of your virtualBox OS

2> start with a live distro

3> untar your virtualBox OS in the target partition/s (/dev/sda1 for example)

4> make the partition bootable (fdisk can help you): # fdisk /dev/sda Command (m for help): a (a = toggle a bootable flag) Partition number (1-4): 1 (1 = /dev/sda1) Command (m for help): q (q = exit)

5> install grub into mbr (https://wiki.ubuntu.com/Grub2) # mount /dev/sda1 /mnt/ # mount --bind /dev /mnt/dev # mount --bind /proc /mnt/proc # mount --bind /sys /mnt/sys # cd /mnt && chroot . #(chroot) update-grub #(chroot) grub-install /dev/sda (NOT /dev/sda1!) #(chroot) grub-install --recheck /dev/sdX

6> Enjoy...


What exactly from the install do you want to migrate? If all you care about are user data and preferences, you could probably just copy everything from your home directory on the VM to a file system outside the VM (a keydrive, for example), copy those files over to a fresh Ubuntu install and then reinstall any programs you had installed on the VM. Depends on how much you've customized the VM install, versus how much trouble the other solutions here would be.


I like to use rsync for backing up my system. This is good for a home directroy or ect directory but might not be what you're looking for in terms of a complete system migration. To use rsync, you'll need to install ubuntu on both systems. Update both of them so that the packages are the same and are at the same level (this isn't mandatory but does make things easier). Then, to copy your home dir from server1 to server2 you can run the following on server1:

$rsync -avz /home/username/ username@server2:/home/username/

The thing that I like about this is that rsync will calculate the differences between directories and transfer the changes rather than everything. This way you can keep your backup current by running on server2 (to backup on server1):

$rsync -avz /home/username/ username@server1:/home/username/

hth