Boot Linux From Physical Drive In Virtual Box on Mac OS

Learn How To Boot Linux From Physical Drive In Virtual Box on Mac OS

Learn How To Boot Linux From Physical Drive In Virtual Box on Mac OS

Today we will Learn How To Boot Linux From Physical Drive In Virtual Box on Mac OS, I am sharing my Experiences and knowledge with you. we all know how to boot from the physical drive but in case we want to boot physical drive in virtual Box on Mac OS this blog will help you. This blog is for Linux or UBUNTU live USB and instead of Linux it can be used in any operating system.

I have illustrated a very easily understandable step by step process in this blog

Follow this steps:

Step: 1 List All Disks on System

It will list all your disks on a system, Now by using this command Identify the Disk and select it.

diskutil list

after using this you will get this results.

Step: 2 Unmount the disk we want to use

Now by Using this command, select the disk which you want to unmount and by applying this code access it.

sudo diskutil unmountDisk /dev/disk2 

Step: 3 Create a Virtual Disk from Raw Disk

Now for creating a virtual disk for your Raw disk Use this code, it will create easily create a raw disk for you.

Sudo VBoxManage internal commands createrawvmdk-filename physical_disk.
vmdk -raw disk /dev/disk2

Note: Only use disk here. Do not use Partitions, because it will not work in Virtual Box.

Step: 4 Create a new Virtual Box Machine

Now, Create a new virtual box machine or open settings of an old virtual machine and set the newly created VMDK to the machine.

 Boot Linux From Physical Drive In Virtual Box on Mac OS
Virtual Box will show an error if you are not logged in as a root.

 Boot Linux From Physical Drive In Virtual Box on Mac OS

Step: 5 Use this command to get rid of this error and try again

this error will be shown continuously to get rid of this error use this code and try again

sudo chown <user name>:staff physical_disk.vmdk

Now, Run the Virtual Machine

 Boot Linux From Physical Drive In Virtual Box on Mac OS

Step: 6 Create Executable for the repetitive Tasks:
After Running the virtual machine create executable for the repetitive tasks using this code.

echo "diskutil umountDisk disk2|sudo chown <user name>:staff /dev/disk2" 
> startVirtualMachine.command
echo "diskutil mountDisk disk2|sudo chown root:system /dev/disk2" 
> stopVirtualMachine.command chmod +x *.command

After Applying all this step here is one Final Step for you to run the file.

Before starting virtual machine double click on ”

startVirtualMachine.command" 

file created in the last step.
Lastly, after finishing with your work double click on

"stopVirtualMachine.command"file.

Leave a Reply

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