Run Windows 8.1 with dual boot and through a virtual machine

Although I’ve been a Linux/Unix-fanatic for almost two decades, the reality is that from time to time, I need to use MS Office, MS Outlook og MS Project at my day job.

I’ve had Windows 8.1 side by side with Linux for a while now, but I am seriously getting tired of having to boot between the two operating systems. So I had this idea:

Surely, it must be possible to boot the already installed Windows 8.1 through a virtual machine from my Linux desktop.

Indeed, it does! And here’s how to do it!

In Windows

Start your machine into Windows 8.1, and turn off the «fast boot option» to ensure that Windows unmounts the disks properly when you shut it down.

Now, shut down windows and boot into Linux. The rest of the work will be done from your Linux desktop.

In Linux

1. As root, add your local user to the disk group

$ sudo usermod -a -G disk <yourusername>

2. After this, you need to log out and log back in. Verify by opening a terminal and typing this:

$ id

The list should now show the group «disk» like this:

uid=1001(gz) gid=1001(gz) groups=1001(gz),4(adm),6(disk),27(sudo),108(lpadmin),124(sambashare)

3. Open up a second terminal and log in as root. Download and install virtualbox.

$ sudo su -
# apt-get update && apt-get install -y virtualbox

5. Change the permissions on the disk

# chmod 666 /dev/sda

It should look like this:

# ls -lA /dev/sda*
brw-rw-rw- 1 root disk 8, 0 mars 23 15:21 /dev/sda
brw-rw---- 1 root disk 8, 1 mars 23 15:21 /dev/sda1
brw-rw---- 1 root disk 8, 2 mars 23 15:21 /dev/sda2
brw-rw---- 1 root disk 8, 3 mars 23 15:21 /dev/sda3
brw-rw---- 1 root disk 8, 5 mars 23 15:21 /dev/sda5
brw-rw---- 1 root disk 8, 6 mars 23 15:21 /dev/sda6

6. I need to figure out which partitions my VM needs to access

# fdisk -l
Disk /dev/sda: 238,5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x56e914d2

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1023999 1021952 499M 7 HPFS/NTFS/exFAT
/dev/sda2 1024000 303652920 302628921 144,3G 7 HPFS/NTFS/exFAT
/dev/sda3 303654910 500117503 196462594 93,7G 5 Extended
/dev/sda5 303654912 466757631 163102720 77,8G 83 Linux
/dev/sda6 466759680 500117503 33357824 15,9G 82 Linux swap / Solaris

Allright, I need partition 1 and 2, as they are the windows partitions, and I also need the partiton where my GRUB lives, partition 5.

Now create the VMDK RAW file with partitions 1, 2 and 5 as your regular user

$ VBoxManage internalcommands createrawvmdk -filename ~/.config/VirtualBox/windows8.vmdk -rawdisk /dev/sda -partitions 1,2,5 -relative
 RAW host disk access VMDK file /home/gz/.config/VirtualBox/windows8.vmdk created successfully.

7. Start virtualbox, create a new machine as the following screenshots

Screenshot from 2015-03-24 11:56:57

Screenshot from 2015-03-24 11:57:20

Screenshot from 2015-03-24 11:57:31

8. Configure your machine as the following screenshots

Screenshot from 2015-03-24 11:58:18

Screenshot from 2015-03-24 11:58:05

9. Start the virtual machine, select Windows 8 from GRUB, and off you go!

Note: It is crucial that you do NOT boot into Ubuntu through your virtual machine, as this will most likely lead to system file corruption. Select Windows 8 from GRUB, and off you go!

Screenshot from 2015-03-24 12:43:36

Screenshot from 2015-03-24 11:59:16

Screenshot from 2015-03-24 11:59:25

Screenshot from 2015-03-24 11:59:49


Legg igjen en kommentar

Fyll inn i feltene under, eller klikk på et ikon for å logge inn:

Du kommenterer med bruk av din konto. Logg ut /  Endre )


Du kommenterer med bruk av din Google+ konto. Logg ut /  Endre )


Du kommenterer med bruk av din Twitter konto. Logg ut /  Endre )


Du kommenterer med bruk av din Facebook konto. Logg ut /  Endre )


Kobler til %s