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

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...

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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