Results 1 to 6 of 6

Thread: Need to move VM to physical machine.

  1. #1
    Join Date
    Nov 2005
    Beans
    15
    Distro
    Ubuntu 8.04 Hardy Heron

    Need to move VM to physical machine.

    How would I go about taking an ubuntu server installed in a VM and migrating it to a physical machine. Any help is appreciated.

  2. #2
    Join Date
    Oct 2007
    Location
    Auckland, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Need to move VM to physical machine.

    I would guess you would be able to do it by copying the files to a partition and then setting up the bootloader
    First they ignore you, then they laugh at you, then they fight you, then you win ~ Mahatma Gandhi

  3. #3
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,505
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Need to move VM to physical machine.

    Quote Originally Posted by talsemgeest View Post
    I would guess you would be able to do it by copying the files to a partition and then setting up the bootloader
    Or copying the VM files into one tar file, and then untaring into a fresh filesystem.

    Then you would have to reconfigure the graphics from the VM settings.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  4. #4
    Join Date
    Oct 2005
    Location
    Al Ain
    Beans
    7,906

    Re: Need to move VM to physical machine.

    Actually, I would not do that. I would install VMware on the new machine and move the VM. That may, you retain the flexibility.

  5. #5
    Join Date
    Oct 2007
    Location
    Auckland, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Need to move VM to physical machine.

    Quote Originally Posted by HermanAB View Post
    Actually, I would not do that. I would install VMware on the new machine and move the VM. That may, you retain the flexibility.
    But they want a full machine, not virtual, which is the point of this thread
    First they ignore you, then they laugh at you, then they fight you, then you win ~ Mahatma Gandhi

  6. #6
    Join Date
    Jan 2008
    Beans
    28
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Need to move VM to physical machine.

    I would do a live boot on the target machine and from inside of that, partition the disk and create the file systems corresponding to those on the VM. Be sure to run mkswap on the swap partition.

    From there, I would tar up the files on the source machine (I prefer to do so for each directory in / since there are some we want to leave out) using
    Code:
    tar czvpf root_backup.tgz root/
    I would exclude proc and sys. However, since these need mountpoints on your target system, be sure to create the directories /proc and /sys on the target machine.

    Mount the root partition from within the live boot.
    Transfer the tgz files to the live booted target machine and unzip them in the appropriate place using:
    Code:
    mount /dev/root_partition /mnt/root_mountpoint/
    Code:
    cd /mnt/root_mountpoint/
    Code:
    tar zxvf root_bacup.tgz
    ...

    Next, you'll need to copy the MBR from the source machine to the target machine, otherwise it won't be able to even reach grub or lilo. Now, if the VM you are transferring from has a different partition table, you'll need to only grab the first 446 bytes of it. The entire MBR is stored in 512 bytes. (More below).

    First, find out which hard disk device you are booting off of:
    Code:
    sudo fdisk -l
    Look at which disk has a bootable partition (indicated by a * under the boot column). Now, say it is /dev/sda1 that is bootable, run:
    Code:
    sudo dd if=/dev/sda of=mbr.iso bs=512 count=1
    Notice how the device used is /dev/sda and not /dev/sda1 .
    If you are copying to a target machine with different partitions (and therefore a different partition table), only copy the first 446 bytes:
    Code:
    sudo dd if=/dev/sda of=mbr.iso bs=446 count=1
    Transfer that file to the target machine. Load it on the target machine (using /dev/sda contains your bootable partition on the target machine):
    Code:
    sudo dd if=mbr.iso of=/dev/sda bs=446 count=1
    or:
    Code:
    sudo dd if=mbr.iso of=/dev/sda bs=512 count=1
    Edit the /etc/fstab (remember that is relative to your root mountpoint, e.g. /mnt/root_mountpoint/etc/fstab - it's easy to forget when you're in a live boot) file to point them to the new partitions, if you've changed them.

    Now you should have something that is bootable at least. I would probably change the xorg.conf file on the target machine to change the driver from "vmware" to whatever it is that is used by that machine (e.g. "nv", "ati", etc.).

    The rest should probably just be changing the hardware configurations, which will be specific to your machine.

    If you're lucky, that should be all you need. I've actually only done the opposite (p2v, rather than v2p also with RHEL3 instead of Ubuntu, although I imagine this will probably be easier) so there may be new issues here. Post here if you have any trouble or questions about my instructions.
    Last edited by mvan83; March 29th, 2008 at 01:16 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •