3

I created a disk image of a Ubuntu (12.04) system by using

dd if=/dev/sda6 of=xxx.img

The VDI image was created by using

vboxmanage clonehd xxx.img xxx.vdi --format VDI

When I create a new VM in VirtualBox and use the created VDI as mass storage the system does not boot because VirtualBox finds no bootable medium:

FATAL: No bootable medium found! System halted.

What else do I need to do in order to make the VDI image bootable?

1 Answer 1

2

I did it in the following way:

~$ fallocate -l xxsizeM xxx.img
~$ fdisk xxx.img

Partition as needed and don't forget to leave some space at the beginning and set a partition bootable flag using 'a' and a partition number.

~$ losetup -f --show xxx.img

Will connect your file to a loop device /dev/loopY. Remember that Y number.

~$ kpartx -a /dev/loopY

Now you have access to this disk as if it was a normal HD through /dev/mapper/loopYpZ where Z are your partitions as you set them up using fdisk.

dd your ubuntu to the bootable partition (i would run mkfs.xxfstype /dev/mapper/loopYpZ first just in case).

~$ dd if=/usr/lib/syslinux/mbr.bin of=/dev/loopY conv=notrunc 

to clone your mbr contents into the image's mbr.

~$ sync; kpartx -d /dev/loopY; losetup -d /dev/loopY

Convert your image to vdi/vmdk as you did, and now it should work for you... Hope that helps...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .