I’ve been using linux as my daily driver for over 5 years now, but sometimes I do need other operating system available for several tasks, windows for gaming, other linux distros for testing my apps, etc. In this case my main laptop is an Acer Aspire F5 with a 5.13.0 kernel version, 24 Gb of RAM and a Intel i5-7200U @ 2.5 GHz and my main OS is POP OS 21.04 and is installed in a NVMe drive of 1 TB, I recently installed Fedora 34 with 5.14.9 kernel on an internal SATA drive. I didn’t want to reboot my computer everytime I needed the other distro, so I solved the problem with VirtualBox, creating a Virtual Disk and pointing the virtual disk file to the physical drive.

Not going to describe the fedora installation but follow the documentation on the official page. Also this is applicable to any kind of OS, either windows, unix-like, DOS, etc.

Once the OS is installed, in the host OS go to the terminal and execute the following:

VBoxManage internalcommands createrawvmdk -filename "name-of-your-virtual-disk.vmdk" -rawdisk /path/to/partition

In my case, I named my disk: fedora.vmdk and the path being /dev/sda, Make user the USER is in the disk group if not, execute

sudo usermod -a -G disk $USER

Note: Use root user or sudo if not comfortable with the above operation.

Once the file is created, go to VirtualBox and create a new virtual machine with the chosen specifications, like memory, name but at the moment of creating the disk just select the created file.

if everything goes well, you can see the other OS in virtual box once it starts the VM.

PROS:

CONS:

devops  sre  fedora