I am planning to setup a ubuntu server on a virtualbox image. So that if anything goes wrong, I can cimply discard it. My question is, once I am done with all configuration and installations, can I move it to a real server?
Technically it would be possible, but not recommended.
You can use the VBoxManage tool to convert a VDI to another imagefile so that not only Virtualbox can read it. You could do it, with this command:
(Out the top of my head, not 100% sure)
Once you have this .img-file you could then restore this image on a disk with
While this COULD work for some distros, it is more likely to fail because the kernel expects the VirtualBox virtualized hardware that will be replaced with the actual server hardware.
So the bottom-line is: Don't do it, just rebuild the server once you know how to do it.
You can connect physaical disk to virtualbox machine: link, copy entire system on it, fix
Most of drivres, required to boot the system, are built in linux kernel image and initial ramdisk, all other hardware in initilized by udev. Likely you won't have problems with hardware.
Yes. Just use any cloning method dd, ghost, clonezilla, etc..