Message

I've been playing with converting machines to VMs and working with qemu. dd seems to be the easiest way to accomplish this on a linux (probably works well with M$).

Below are some of the initial steps I've used to create a usable disk image of an existing system:

 

Create a backup of a linux disk for use as a VM disk (works for qemu and Virtual Box)

#create a 10 gb image
dd if=/dev/zero of=/whereever/image.raw bs=1MB count=0 seek=10240

#format
mkfs.ext3 -F /whereever/image.raw

#mount
mount -o loop /whereever/image.raw /mnt/disk

#rsync
rsync -avzx / /mnt/disk/ --exclude=kcore --exclude=mnt --exclude=image.raw

#in windows convert the image to a vmdk (similar command exists for linux)
qemu-img.exe convert -O vmdk x:\image.raw x:\image.vmdk

I use both Virtual Box, and qemu to run these VM hosts. The only thing I have not worked out is the bootloader. I have been installing the bootloader with grub from a boot cd, but I think this can be accomplished with using dd to copy the first 466 bytes of a working system disk as such:

dd if=/dev/sda of=/tmp/mbrsda.bak bs=512 count=1

dd if=/tmp/mbrsda.bak of=/dev/sdb bs=446 count=1

This will effectivly give you a backup of your current MBR and partition info, but only restore the MBR. I HAVE NOT TESTED THIS, but looks like it should work.




Joomla templates by a4joomla