I want to setup a Ubuntu install on a virtualbox and then use this later to install onto a machine. I know I can create clones of partitions using something like Clonezilla, but is something similar possible when using a Virtualbox? I am not opposed to using VMware if it has such a function.
Virtualbox has the option to use raw disks instead of files for its hard drives. See: https://www.virtualbox.org/manual/ch09.html
It should be possible to do the following:
Create a vmdk file to tell virtualbox where you want the image. This is a small text file that simply tells virtualbox where you want it to look for the guest OS. Execute the following command, changing the file convention to suit your OS:
VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda
Alternately you can manually create and edit a .vmdk text file
- Create the new virtual machine in virtualbox in the usual way, except choose Use existing hard disk and select your vmdk file.
Now it should be theoretically possible to use that drive in another computer. However, I imagine that there may be problems with the virtualization drivers (e.g. guest additions). Linux is pretty good about sensing new hardware though, so it may work.
It's also possible to use an LVM as your rawdisk and to clone it to a new disk.