Virtualization of Windows under the Linux

Posted on

Problem :

I have a problem. I am using dualboot on my laptop – Kubuntu and Windows 8.1.

/dev/sda1 – EFI partition, /dev/sda4 – Windows OS partition

# fdisk -l
Disk /dev/sda: 698,7 GiB, 750156374016 bytes, 1465149168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 412A5759-6D0A-430C-BBC1-490676A37D10

Device          Start        End    Sectors   Size Type
/dev/sda1        2048     206847     204800   100M EFI System
/dev/sda2      206848    2050047    1843200   900M Windows recovery  environment
/dev/sda3   333400064 1423183871 1089783808 519,7G Microsoft basic data
/dev/sda4     2050048  211765247  209715200   100G Microsoft basic data
/dev/sda5   317413376  333400063   15986688   7,6G Linux swap
/dev/sda6  1423183872 1465147391   41963520    20G Windows recovery environment
/dev/sda7   211765248  317413375  105648128  50,4G Linux filesystem

Partition table entries are not in disk order.

Because I’ve gotten tired of rebooting to windows and back to linux, I’ve decided to make a virtual hdd where are just windows (and boot sector, if needed) and run them from virtualbox under the linux.

I tried to create raw disk using VBoxManage:

sudo VBoxManage internalcommands createrawvmdk -filename /mnt/data/virtual/win.vmdk -rawdisk /dev/sda -partitions 1,4 -relative

But if I try to run it in virtualbox, I just get into grub, which was on /dev/sda1 and I cannot boot from there.

screen shot

My question is, is there any way to either

  • Use raw disk as I tried and boot the physical partition with Windows.
  • Or create an image of Windows (and boot if needed) and use them under the VirtualBox?

I tried using disk2vhd in Windows to create the image, but the program didn’t see the /dev/sda1, so i just could create the image of /dev/sda4 (Windows).

I also tried to run only the image of Windows created by the disk2vhd, but I just get into ”shell” (but no commands were able to run there) after some errors:

screen shot

So I inserted a CD with Windows on it so I can repair it, but without success.

Does someone understand to do it this way? Or know how to do it?

Solution :

I’m sure your Windows installation is not going to like running on different hardware (real HW & VirtualBox).

I’d go for your 2nd option: install a brand new Windows in a new Virtual Machine, either using a raw disk or a disk image file.

Leave a Reply

Your email address will not be published. Required fields are marked *