- Transferring Operating System from VM to Physical System
- 1 Answer 1
- Migrating a Windows Guest
- Migrate from a virtual machine (VM) to a physical system
- 5 Answers 5
- Preliminary step: Convert the disk to something useful
- Write the image to a disk of its very own
- Write the image to a disk alongside another operating system
- Converting A VMware Image To A Physical Machine
- 1 Requirements
- 2 Preliminary Notes
- 3 VMware Configuration
- 4 CloneZilla Cloning Process
- 5 Troubleshooting Physical Machine
Transferring Operating System from VM to Physical System
I have Ubuntu 13.04 running in a VM in VirtualBox. Originally, I was just trying it out, but now I’ve started using it a lot, and I have many of my programs and files in it. Is it possible to transfer this to a partition on my hard drive? Also, (this would be much more preferable), is it possible for me to transfer it to a bootable USB? My System: Ubuntu 13.04 64 bit running in VirtualBox Windows 8.1 Pro 64 Bit
1 Answer 1
The terminology you’re looking for is often called physical to virtual or virtual to physical. It’s often shortened to P2V and V2P.
There’s a tutorial on how to do this for VMware and Virtualbox over on the AskUbuntu site. The Q&A is titled: Migrate from a virtual machine (VM) to a physical system.
Migrating a Windows Guest
I found these instructions for migrating a Windows VM V2P. They’re untested by me but seem plausible. The tutorial is titled: V2P Virtual to Physical.
This is an easy tutorial on how to take a Windows installation in Virtual Box, or any other Virtual software for that matter, and turn it into a physical machine. This has been tested on Windows XP x86 and x64 as well as Windows Vista,7 X86 and x64. This tutorial is assuming you have advanced knowledge of installing Windows/Virtual OSes/changing boot settings…etc etc OK? Now let’s get started.
These are the steps, verbatim.
1) First off, make sure you have the machine configured the way you want before making an image of it. This is assuming you are using it to test software or make an image for multiple computers. Install the software you want and the updates you need as well as any antivirus software. An important note when installing software: Do not install the Virtual Machine Add On’s (VirtualBox) or VMware tools (VMWare) as this is almost always likely to cause a bluescreen due to the IDE Controller driver being totally, and not even remotely the same, as a physical IDE controller.
2) Download Macrium Reflect Free Edition. (do a Google search, everyone knows how!) Then install it on your Virtual Machine. Right click on the virtual drive you installed Windows too and right click and choose “Create Image of this Disk” Some Side notes: I would recommend mapping an external drive as the place of backup for this image. Plug in a USB hard drive or map a network drive in the Virtual Machine settings. (maybe I’ll do a tutorial on this). I say an external drive because making a backup on the same drive the virtual machine is running off of could cause the time it takes to copy the backup increase drastically.
3) After the image has been successfully created, restore that image to the hard drive you will be using to install in your physically machine. To do this, right click on the image that Macrium has created and choose “Restore Partition”. When you go through the steps, one of the options asks you to assign a drive letter. Click “Do Not assign a drive letter” If you Assign it anything other than C, it’ll causes issues since that’s what your virtual machine drive letter was to being with. You can’t assign it ‘C:/’ anyways because the computer you are on most like has that drive letter taken already. The other option to look out for is when it asks if you want to restore the MBR with a default one. ALWAYS choose to restore the MBR with the one from the backup.
4) After that has completed successfully, go into Windows Disk management in Windows and right click the drive you just restored the image too as “Active”. This will tell the BIOS of the machine you are placing this drive in that it has a bootable partition on it. If you don’t set it to active, the BIOS will tell you that there is no boot device available.
5) Go ahead and put the hard drive in the computer you wish to boot it from. Make sure all the plugs are in the proper place and IDE is configured properly (AKA Master and Slave jumpers if on IDE)
6) Next step, before you even turn on the computer, is to pop in your windows CD. Whether is be Windows XP or Windows Vista/7. Always remember to use the right version of the architecture that corresponds to the one you used when installed in a virtual machine. I.E. if you installed Windows 7 x86 then use a Windows 7 x86 USB/DVD for the next step.
7) Boot from the proper DVD/CD and choose “Repair your Computer”and choose Command Prompt (Both Windows XP an Vista/7)
8) now type “bootrec /fixboot”
9) Restart your laptop/desktop and windows should start booting up!
Migrate from a virtual machine (VM) to a physical system
Is it possible/feasible to migrate a Virtual Machine installation of Ubuntu onto a physical machine? If possible, how difficult would this be to accomplish and what steps would i need to take to prepare for the migration. I’d like to do some testing on a VM and if it works out migrate that system to physical hardware instead of reinstalling everything. Is this possible?
5 Answers 5
Yes, it’s possible. It’s not even that hard, it just takes some time, a Ubuntu LiveCD, sticky-back-plastic, and an external USB disk (if you don’t have more than one internal disks).
Preliminary step: Convert the disk to something useful
Both VMWare and VirtualBox (amongst others) use disk formats that don’t lend themselves well to being written directly to disk. You can but I personally feel it’s more convenient to write it to an intermediary, standard image first. You can do this from your current system without having to boot to a LiveCD.
- Load a terminal and fire in:
cd /media/wherever-the-image-is/ # for VMWare sudo apt-get install qemu-kvm qemu-img convert your-vmware-disk.vmdk -O raw disk.img # For VirtualBox VBoxManage clonehd your-virtualbox-disk.vdi disk.img --format RAW
Write the image to a disk of its very own
You’ll want to do something like this. This assumes you’re going to overwrite a whole disk. If you want to do an alongside-Windows install, don’t follow these instructions! Skip to after the bullets.
- Boot into an Ubuntu Live CD and click Try Ubuntu.
- Mount your the place where your vmdk image is being stored (eg the external USB disk as /media/dave ). Do not mount the place where you want to write to.
- Then we go to work:
sudo dd if=/media/dave/disk.img of=/dev/sdX
Write the image to a disk alongside another operating system
This is perhaps an altogether safer way of doing things. The idea is very similar apart from you do a proper install of Ubuntu and then just sync over the files from disk.img .
- Your LiveCD this time will need to be the same version of Ubuntu as your virtual install. Boot into the Live CD and, again, click Install.
- Follow the installer through, repartition things as you see fit. About 10 minutes later, you’ll be installed and it’ll ask you to reboot. Don’t reboot. Doesn’t matter if you accidentally do, just make sure you’re back in the LiveCD for the next instructions.
- Mount your new install’s partition and your external disk where you’ve stored the disk.img from earlier (just double click them in nautilus).
- Mount your disk.img ISO in a terminal:
sudo mkdir /media/oldinstall sudo mount -o loop /media/dave/disk.img /media/oldinstall
-Note — After creating the desired .img file, sometimes when you try to mount it as a loop device you might get the following error «NTFS signature is missing. Failed to mount ‘/dev/loop0’: Invalid argument The device ‘/dev/loop0’ doesn’t seem to have a valid NTFS. « A .img file sometimes contains a master boot record and a partition table before the actual partition that you might want to mount. Hence you need to find out the offset of the required partition. To this, one can use the parted tool. For an example, look at the answer by sisco311 in this link http://ubuntuforums.org/archive/index.php/t-1576011.html So, if you have determined your offset to be ‘xxx’ then you can mount your partition using
sudo mount -o loop,offset=xxx /media/dave/disk.img /media/oldinstall
sudo rsync /media/oldinstall/ /media/my-new-install/
Converting A VMware Image To A Physical Machine
This tutorial shows how to convert an existing linux VM to a Physical machine. This tutorial covers the cloning of the VM to an unpartitioned HDD and troubleshoot some of the possible errors that you may have booting the OS on your new hardware. To illustrate this procedure I will use VMware Workstation 7 as the handler to transfer the VM installation to a physical HDD.
1 Requirements
- VMware Workstation, VMware Server or VMware Player.
- CloneZilla ISO image.
- Unpartitioned HDD with enough space to hold your VM image.
2 Preliminary Notes
This tutorial assumes basic knowledge of the cloning process and requires no previous experience on the use of Clonezilla. Make sure your OS is not using in any way the target HDD that will hold your final copy of the VM, otherwise VMware will complain about your disk been in use and CloneZilla will not perform a successful copy of the VM.
3 VMware Configuration
First thing is to make sure your virtual CD/DVD is using your CloneZilla ISO image to boot. Next add your physical HDD as part of your existing VM by clicking the Add button.
Select Hard Drive and click Next .
Select Use physical disk (for advanced users) then click Next .
Make sure you select the correct drive that you want to use for your physical disk and select the option Use entire disk .
Finally give a name to your configuration file then click Finish .
Make sure your final VMware hardware list include this two elements otherwise, start all over.
4 CloneZilla Cloning Process
Start your VMware and boot from your virtual ISO into CloneZilla image. Use the Live option with default settings.
Select your preferred language and continue.
Accept the default option Don’t touch keymap and continue.
Select Start_Clonezilla and continue.
Select device-device option and continue.
Select Beginner mode and continue.
Select disk to local disk and continue.
Select your source disk and click OK .
Select your target disk and click OK , then press Enter to continue.
You will be presented with a warning, about your existing data on your target disk will be lost, make sure there’s nothing usable on your disk before you continue.
You will be presented with a series of questions answer yes to all this prompts.
The cloning process may take a long time.
After the cloning process is finished hit Enter and power off the VM by pressing 0 on the CloneZilla menu.
The cloning process is complete, is now time to install your new HDD to your physical machine.
5 Troubleshooting Physical Machine
More likely your first encounter with your cloned OS will be a filesystem corruption, with the following error: Unexpected Inconsistency. To fix this problem enter your root password and run fsck -y to start the filesystem repair process. The -y answers yes to the questions the fsck command will probably output.
Deleting the file forces the detection process to run again at boot with no baggage left over from the cloning process. The other way to fix this problem is by edit: /etc/sysconfig/network-scripts/ifcfg-eth0 and add the MAC address of your new NIC.
Open eth0 using vi, type: vi /etc/sysconfig/network-scripts/ifcfg-eth0
This is my sample config file:
# Micro-Star INT'L CO Gigabit Ethernet Controller DEVICE=eth0 BOOTPROTO=static DHCPCLASS= HWADDR=00:19:B1:2A:BA:B8 IPADDR=172.22.16.10 NETMASK=255.255.255.0 ONBOOT=yes