3

I've spent 3 weeks trying to solve this, but to no avail. I'm aware of the many posts on this topics.

I've already read and tried at least:

Migrate from a virtual machine (VM) to a physical system
Convert VirtualBox (VM) Machine TO Physical Drive
DD tutorial - how to clone, backup and restore disks and partitions
restore using dd will not boot

I've created a lubuntu 20.04 with certain packages and files in a VM. But I can't install it into a physical laptop (need to make many identical laptops with same configs). I can wipe all drives so I don't need to worry about dual boot.

Steps I've taken: VM system: virtual box 7.0 (created a lubuntu 20.04), 10Gb
Laptop system: 125Gb (want to install lubuntu 20.04 with files/packages)

  1. Created a lubuntu VM with fixed partition (not dynamic allocation)
  2. I've created an .img and tried both with VBoxManage... and dd within the VM.
  3. Booted into a Live usb installed lubuntu on the laptop disk then dd the img file into sda (the disk not sda1)

When I run lsblk the boot partition is missing unlike the results of Convert VirtualBox (VM) Machine TO Physical Drive.

  1. I've tried to offset and install the MBR but the VM does not have a boot partition only sda1
  2. I've tried install-mbr (but not in depth)

At this point and age I feel that this is important enough that there's a tool. It looks like that this question has been asked for over a decade.

Thanks : )

D. Ip
  • 33

2 Answers2

3

I have done it successfully on a non-UEFI machine (not claiming that it won't work on a UEFI machine, I just haven't tried it).

I used my go-to tool for such things, Clonezilla. I booted the VM using a Clonezilla .iso and cloned the disk to a shared drive on my server.

I then booted the physical machine using a Clonezilla thumbdrive and restored the clone off the server.

It worked fine. I did go in and remove the Guest Additions from the physical machine by going to /opt/VBoxGuestAdditions-(version) and running the uninstall.sh with sudo. (Guest Additions were causing a message to appear somewhere - I forget the details) I probably could have done that before cloning had I thought of it.

1

Organic Marble's answer is great, I just logged in to thank him. Only thing I did differently was that I booted from the VM but I had no need or access to a remote network location, so you can also pass a Virtual Machine to a Physical one directly by doing the following:

  1. Plug into your VM host an external SSD USB encased drive (you can install it internally later)
  2. Load clonezilla ISO into your VirtualBox CD-ROM drive
  3. Attach the external SSD USB Device to your VM
  4. Boot from the Clonezilla ISO CD-ROM
  5. Once Clonezilla is loaded, chose "device to device" clone
  6. Carefully select source drive (VM's hardrive) and destination drive (attached external encased USB SSD)

It will take a while to clone the entire VM's hardrive into your external USB SSD but should work well, I just moved a Windows Server 2019 VM back into another physical drive and works well even after shrinkin the Windows Server partitions.