I think probably the easiest way to transfer your VirtualBox OS to a partition would be to mount it, and then copy its entire file system to its new partition with "cp -ax" to preserve all the proper permissions/ownerships of all files. Most VirtualBox VDI files have just 3 sectors of VirtualBox header info at the beginning, and then the rest is the HDD image. So to mount a VDI file, you can usually do:
Code:
sudo losetup -f --show -o $((512*3)) ~/.VirtualBox/HardDisks/HDD_image.vdi
That will also return the loop device that the VDI file gets associated with, for example "/dev/loop0". And then to see the partitions in that image:
Code:
sudo fdisk -lu /dev/loop0
Using the above command, find the sector offset of the partition you want to mount, say for example the starting sector is 63, then do:
Code:
sudo mount -o loop,offset=$((512*63)) /dev/loop0 /mnt
And that will mount your VirtualBox OS partition on /mnt. After that, it's just a matter of copying the file system to its new partition:
Code:
sudo cp -ax /mnt/* /path_to_mounted_destination_partition/
And lastly, if you do:
Code:
sudo blkid -c /dev/null
It will show you the UUID of your mounted VirtualBox partition, and you can transfer that UUID to the new partition with:
Code:
sudo tune2fs -U <VirtualBox partition UUID> /dev/<new partition>
You will probably have to modify /boot/grub/menu.lst and possibly /etc/fstab for the OS on the new partition, but that should be about all it takes. Let me know if you decide to give this method a try and how it goes.
Bookmarks