Sie sind auf Seite 1von 6

2/8/23, 11:22 AM Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten – The Digital Native

Direkt zum Inhalt wechseln


Suchen
The Digital Native
Das leben in der digitalen Welt
Menü

Startseite
Zitate
Publikationen
Glossar
Links
Projekte
OccuSearch
OccuCloud
OccuMail
Privacy Captcha
Dokumentenvorlagen
Registervorlagen
Ordnerrücken
Visitenkarten
Musterschreiben
About
Newsletter
Anmelden
Archiv
Kontakt

Suchen
Suche nach: Suche … Suchen
Suche schließen
Menü schließen

Startseite Untermenü anzeigen


Zitate
Publikationen
Glossar
Links
Projekte Untermenü anzeigen
OccuSearch
OccuCloud
OccuMail
Privacy Captcha
Dokumentenvorlagen Untermenü anzeigen
Registervorlagen
Ordnerrücken
Visitenkarten
Musterschreiben
About
Newsletter Untermenü anzeigen
Anmelden
Archiv
Kontakt

Mastodon
Twitter
Diaspora
Facebook
Flickr
Instagram

Kategorien
German Linux Virtualisierung

Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten


Beitragsautor Von The Digital Native
Beitragsdatum 1. Juni 2020

https://the-digital-native.de/?p=366 1/8
2/8/23, 11:22 AM Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten – The Digital Native

Kürzlich habe ich ein Lenovo P1 erworben, welches bereits ein vorinstalliertes Windows 10 Pro hatte. Natürlich habe ich direkt ein Linux installiert: In meinem
Fall ein Kubuntu 20.04. Dazu habe ich die bereits existente NTFS-Partition mit Windows Installation auf 850GB etwas verkleinert und 100GB freien Platz für
Linux geschaffen. Warum habe ich die NTFS-Partition so groß gelassen? Weil es nach meinen Recherchen wesentlich besser funktioniert von Linux aus auf einer
NTFS-Partition zu schreiben, als in Windows eine ext4 Partition einzurichten. Die gemeinsame Datenpartition wird also die Windows NTFS-Partition. Auf eine
swap-Partition habe ich ganz verzichtet, da 48GB Ram für alles Mögliche ausreichen wird.

So now I have a dual-boot system Ubuntu 20.04 / Windows 10. That's fine. But I also like to have the Windows functionalities to hand (Photoshop, ...) quickly
when using Linux. And since maintaining two Windows 10 instances is double the effort, a way to boot the physical system into VirtualBox comes in handy here.
That's what it's supposed to be about here.

Identify the Windows partitions


I just use the KDE partition manager here. If you don't have Kubuntu and the KDE Partition Manager is missing, it can be installed later:
sudo apt-get install partitionmanager

Let's take a look at partitioning. This should look similar on any system with EFI.

Here we see the following partitions:

/dev/nvme0n1p1a fat32 partition belonging to the EFI. You can also recognize it because it is /boot/efimounted under . This partition is relevant for us
because we need it to boot.
/dev/nvme0n1p2is a so-called Microsoft Reserved Partition , which is actually no longer relevant today.
/dev/nvme0n1p3is now the actually important partition for us. Here lies Windows.
/dev/nvme0n1p5contains our Linux distribution
/dev/nvme0n1p4contains a Windows recovery, in case you have to set up Windows again.

Access rights in the file system


In order to have full access to our Windows 10 partition even without sudofull access, we still have to do something. The best way to do this is to define a udev
rule that groupadds the Windows 10 partition to a specific one.

First, let's create a new group for the Windows 10 partition:

sudo groupadd win10disk

Now add your own user to the group


sudo usermod -a -G win10disk youruser

Now we need to find out the UUID of the Windows 10 partition. This is how it works:
sudo udevadm info /dev/nvme0n1p3 | grep UUID

This should print the UUID, e.g. like this:

https://the-digital-native.de/?p=366 2/8
2/8/23, 11:22 AM Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten – The Digital Native
E: ID_PART_TABLE_UUID=579b23f9-843f-4fec-a246-0ed74800bef1

If there is another unique ID than ID_PART_TABLE_UUID, this also works. Copy the variable and create the file /etc/udev/rules.d/99-
win10disk.ruleswith something like this:

ENV{ID_PART_TABLE_UUID}=="579b23f9-843f-4fec-a246-0ed74800bef1", GROUP="win10disk"

Save the file and reboot now. Now check if everything worked with:

ls -l /dev/nvme0n1p3

The output should look something like this:


brw-rw---- 1 root win10disk 259, 3 Jun 1 13:29 /dev/nvme0n1p3

VirtualBox Raw Host Access VMDK file


In order for VirtualBox to boot the physical partitions from EFI and Windows, a special VMDK (Virtual Machine Disk) file must be created to represent the
partitions. This file doesn't contain any data from the physical partitions, it's just a kind of reference that allows VirtualBox to access it.

You can VBoxManagecreate the VirtualBox raw disk image with . The target directory can be -filenamespecified with the option. We want to mount the partitions
/dev/nvme0n1p1(EFI) and /dev/nvme0n1p3(Windows). That would be partitions 1 and 3 of /dev/nvme0n1:

VBoxManage internalcommands createrawvmdk -filename ~/win10.vmdk -rawdisk /dev/nvme0n1 -partitions 1,3

The output should look something like this:


RAW host disk access VMDK file /path/to/windows10.vmdk created successfully.

Creating and configuring the virtual machine


Create a Windows 10 VM as usual. Under Hard disk , select the option "Use an existing virtual hard disk file" and select the one win10.vmdkyou created earlier.

When the wizard is complete, open the settings of the new VM. Under System , select " Boot Order" as the only "Hard Disk" and disable all other options.
Activate the option "Enable EFI (special OSses only)" if your laptop uses EFI (we assume that here):

https://the-digital-native.de/?p=366 3/8
2/8/23, 11:22 AM Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten – The Digital Native

Under Storage you can check again whether everything is correctly integrated. The file should be selected under Controller: SATAwin10.vmdk . You will probably
want to enable the "Solid-state Drive" option.

Set up GRUB
Now let's start the virtual machine. It is most likely that GRUB will now start without being able to load Windows directly. With lsyou can display all partitions:
grub> ls
(proc) (hd0) (hd0,gtp5) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)

https://the-digital-native.de/?p=366 4/8
2/8/23, 11:22 AM Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten – The Digital Native
We already know that our Windows installation is on partition 3. Let's verify this:
grub> ls (hd0,gpt3)
Partition hd0,gpt3: Filesystem type ntfs - Label 'Windows', UUID ABCDEF - Partition start at 283648KiB

Now do the following:


grub> insmod part_gpt
grub> insmod chain
grub> set root=(hd0,gpt3)
grub> insmod ntfs

/boot/efiWe still have to define the partition mounted in our Linux as /dev/nvme0n1p1a chainloader :
grub> chainloader (hd0,gtp1)/EFI/Microsoft/Boot/bootmgfw.efi

And that was it! We can now start the boot process. The settings made are saved and Windows will start up automatically in the future.
grub> boot

What else needs to be considered?


Don't forget to insert the VBoxGuestAdditions.iso( Devices → Insert Guest Additions CD Image ) and install it. After restarting Windows everything should
work now. In particular, the window size should be freely adjustable.

If this is not the case, it is due to a bug in the current VirtualBox version (6.1.8) that seems to appear on some and not on others. The problem can be solved by
setting the graphics controller to VBoxVGA in the settings of the VM under Display and deactivating Enable 3D Acceleration. That's not ideal, but it's always
better than working on a screen that's much too small. Then shut down the VM cleanly via the operating system and start it up again. It should work now.

Windows 10 Fast Startup & Hibernate


Remember that you have to disable fast startup on Windows 10. But you should do that for simple dual boot as well. Otherwise there will be problems with
possible data loss. Hibernate is also sometimes problematic and I advise against using it.

Conclusion
Es ist erstaunlich, dass Windows 10 in dieser Form so gut funktioniert. Man bedenke, dass wir bei jedem direkten Start andere Hardware haben als über
VirtualBox. Man sollte also Treiberprobleme vermuten. Auch erstaunlich ist, dass keine erneute Aktivierung bei jedem Hardwarewechsel nötig ist. Aber alles ist
super und es funktioniert!

Ich persönlich nutze die VM vor allem für Adobe Produkte (Photoshop, Lightroom, Illustrator, Acrobat Pro), Canon EOS Utility, den Brother P-Touch Editor
(Labeldrucker) und die Steuererklärung (Taxman 2020 für Selbstständige). Insbesondere Photoshop und Lightroom arbeiten unter einem nativ gebooteten System
natürlich besser (Hardwarebeschleunigung!) Eine brauchbare Software für Steuererklärungen von selbstständigen Kleingewerbetreibenden scheint es für Linux
leider nicht zu geben (beweist mir gerne das Gegenteil!)

https://the-digital-native.de/?p=366 5/8
2/8/23, 11:22 AM Eine physikalische Windows 10 Partition unter Linux in VirtualBox booten – The Digital Native
Viele Spaß mit eurem Hybrid-Windows-10

Attribution
Dieser Artikel basiert zum Teil auf dem Artikel „Booting a Physical Windows 10 Disk Using VirtualBox on Linux“ von jamieweb.net. Danke für seine Mühen!

Dieser Artikel ist lizenziert unter der Creative Commons Attribution-ShareAlike 4.0 International License.

Schlagwörter Virtual Box Raw Host Access, VirtualBox, Virtualisierung, Windows 10

Von The Digital Native


Informatiker, Softwareentwickler, Data Analyst, Sysadmin, Datenschützer, Netzaktivist, LGBTQ-Rechtler, Fotograf

Archiv anzeigen →

← Serverseitige Mailfilter mittels Sieve. Einrichtung von Dovecot & Roundcube → HanseMerkur speichert nach Versicherungsantrag rechtswidrig Daten beim
HIS und muss sie wieder löschen

https://the-digital-native.de/?p=366 6/8

Das könnte Ihnen auch gefallen