Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a bunch of VirtualBox VMs (Linux and Windows) and would like to know how to transfer any of them to the metal.

share|improve this question
    
something more generic –  Tshepang Feb 25 '11 at 9:55

2 Answers 2

I'm not sure if you can do this with windows guests. I'll outline what I would do first to move any VM to physical disk, and some "hints" which may help with windows.

So, in general, you need an image of the virtual hard drive:

  1. Check which drives are available (following is a snippet):

    $ VBoxManage list hdds
    Oracle VM VirtualBox Command Line Management Interface Version 3.2.10_OSE
    (C) 2005-2010 Oracle Corporation
    All rights reserved.
    
    UUID:        d6b9f0a5-98df-48ca-83c8-91a0809ec349
    Parent UUID: base
    Format:      VDI
    Location:    /home/wena/.VirtualBox/HardDisks/Debian 6.vdi
    State:       created
    Type:        normal
    Usage:       Debian 6 (UUID: f070af5c-57b1-47db-9300-f17921dee57d) [1 pristine fresh install (UUID: 90e46b07-07d9-4b81-9b7b-dadd75fc13f4)]
    
    UUID:        dfd7deec-b7a7-4e83-967e-17aa8fb1f602
    Parent UUID: d6b9f0a5-98df-48ca-83c8-91a0809ec349
    Format:      VDI
    Location:    /home/wena/.VirtualBox/Machines/Debian 6/Snapshots/{dfd7deec-b7a7-4e83-967e-17aa8fb1f602}.vdi
    State:       created
    Type:        normal
    Usage:       Debian 6 (UUID: f070af5c-57b1-47db-9300-f17921dee57d)
    
  2. Select UUID above and convert it:

    VBoxManage clonehd d6b9f0a5-98df-48ca-83c8-91a0809ec349 --format RAW Debian6.img
    
  3. Then, just copy this image to a harddrive, using dd.

This should work for most Linux machines.

For windows, chances are, that you may have a lot of troubles. I would start with creating a new hardware profile in the VM before I even try.

share|improve this answer
    
Windows may complain about the HDD controller changing. See this MS knowledgebase article or search for MergeIDE. –  Not Sure May 15 '11 at 20:11

Mounting thought loopback device with offset, might be helpful.

VDIfile=VirtData.vdi
mountingpoint=/mnt/VDI
offData=$( VBoxManage internalcommands dumphdinfo "$VDIfile" |grep offData | sed 's:.*offData=\([0-9]*\).*:\1:' )
offset=$(( $offData + 32256 ))
mount -t ext4 -o rw,noatime,noexec,loop,offset="$offset" "$VDIfile" "$mountingpoint"

More details here: http://unix.stackexchange.com/a/45019/9689

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.