Do you have a dual boot? If so, isn't it annoying that you have to reboot each time you need the other os? Then boot from the physical disk with VirtualBox! It's not complicated, we'll see how to do this with a Linux host and a Windows host
- VirtualBox
- A physical disk to boot (the other OS can be on the same disk or another one)
- Open a command line
- Identify which disk you want to boot on (the disk, not the partition, for example
/dev/sda
and not/dev/sda1
) - Give the permissions to the device's file to read it and write to it with either :
sudo chmod 666 /dev/yourDisk
sudo usermod -a -G disk yourUser
, this is another, more secure method, but I didn't test it yet
- Now we'll create a virtual disk (.vmdk) which will be a "link" to the physical hard drive
THIS IS NOT A COPY, ALL THE CHANGES MADE TO THE VIRTUAL DISK WILL BE MADE ON THE PHYSICAL DISK
We make the virtual disk with
VBoxManage internalcommands createrawvmdk -filename "anyNameYouWant.vmdk" -rawdisk /dev/nvme0n1
- Now create a VM, when asked to choose a disk don't create one but choose this file
- Identitify the disk number. For this, you can go in the disk manager and it's written "Disk 0", "Disk 1" etc...
- Open a command prompt as admin :
- Type "cmd" in the search menu
- Right click on the "Command prompt" entry and click "Open as Administrator"
- Now we'll create a virtual disk (.vmdk) which will be a "link" to the physical hard drive
THIS IS NOT A COPY, ALL THE CHANGES MADE TO THE VIRTUAL DISK WILL BE MADE ON THE PHYSICAL DISK
We make the virtual disk with
C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename "anyNameYouWant.vmdk" -rawdisk \\.\PHYSICALDRIVE<theDiskNumber>
If you've chosen a custom path for the VirtualBox installation, change the path accordingly. - Now create a VM, when asked to choose a disk don't create one but choose this file
- If your VM displays "No bootable medium found" when you start it, it probably means that your system is UEFI and your VM tries to boot in BIOS mode. Go in the VM configuration > System and enable "Enable EFI (special OS only)"