This page has been robot translated, sorry for typos if any. Original content here.
How to run Windows 7 (Bootcamp) in VirtualBox
Bootcamp is super, and all that, but ... But there is a much more interesting solution!
Sometimes you want to do a small task that requires running Windows, or alternative Mac software, but you don't want to overload in BootCamp. Or do you want to switch between operating systems as quickly as possible ... VirtualBox can certainly help you! This is a really tasty piece of freeware software that you should fall in love with and learn how to use it. I must say right away - nothing complicated!
VirtualBox allows you to run Windows 7, which you have on Bootcamp as a virtual machine ( VM
) without programming skills. Thus, you can use Windows 7 without restarting the system and save Windows 7 at any time, which will make it possible to start Windows from where you left off. Thus, synchronized data remains inside Mac OS. And most importantly - Instead of creating a virtual hard disk file, like a regular virtual machine, it uses a small special file, which is much more convenient.
Install VirtualBox ( VM ) on Mac OS X.
Create a new Virtual Machine. Follow these instructions until you select Virtual hard Disk:
- Name your VM, select Windows 7, click Continue (I called "Bootcamp")
- Allocate memory (RAM) for the virtual machine (at least put at least 1 GB, 1024 MB) and click Continue.
- Now leave everything as it is, do not close anything, we will do something else before we continue ...
Open the Finder, go to the main page, pay attention to the folder named "VirtualBox VMs", make sure that it contains the folder of your virtual machine (I have Bootcamp).
Open the terminal ( Applications> Utilities> Terminal ) and enter the following diskutil list commands Press Enter / Return, in the section "/ dev / disk0" you need to find the partition number associated with the VM (Bootcamp). It should be 4. diskutil unmount /dev/disk0s4 If your number, from the previous command, is not 4, replace it instead of N with yours, in disk0s N (this must be done both in the previous and in the next command) sudo chmod 777 /dev/disk0s4sudo vboxmanage internalcommands listpartitions -rawdisk /dev/disk0 Type all this on one line and press Enter / Return.
- Enter the administrator password. Entering a password does not appear on the screen, this is normal, continue to enter and make sure that you enter it correctly. Then press the Enter / Return key.
- A list of sections will be displayed. This time you will not see their names. So make your paritition 4 (or your number that we found in the example above) Bootcamp section (Compare the size).
cd VirtualBox VMs/Bootcamp/ Type cdspace then Virt and press tab, the terminal will automatically add the name of your folder. Type Bootcamp (your VM name) and then press Enter / Return. sudo vboxmanage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename "win7.vmdk" -partitions 4 Enter all this into one line and press Enter / Return.
- If the process was successful. It will show "RAW host disk access VMDK file win7.vmdk created successfully".
- Go back to Finder, browse the Bootcamp folder (VM folder). Win7.vmdk and win7-pt.vmdk should appear in it.
sudo chown (username) win7*.vmdk
- Replace (username) with the account name (if you are not sure, type whoami in the terminal window and press Enter / Return.
- Press Enter / Return and enter your password.
Return to VirtualBox. Select Use an existing hard drive and click the yellow folder on the right side, find and select the created win7.vmdk, and click Next.
VirtualBox appears on the Summary page after clicking Finish.
Open the settings of the created VM to configure the settings to your liking.
Network: You must select the Bridge adapter and the network interface used to connect to the Internet.
Shared Folders: select folders so that you can exchange files between Mac and Windows when starting the virtual machine. Do not forget to check the auto-mount box.
Start the VM.
- Install Guest OS Additions
(select from the menu on the Mac while working with the virtual machine) Device> Install Guest Additions , then a virtual CD will appear in Windows 7. Install and restart the virtual machine.
- After rebooting, if the shared folder does not appear, select the Connect a network drive item on the toolbar and find the shared folder and check the Restore at login box.
- If you use VBox's Seamless Mode, this is the mode that runs Windows applications on Mac as native.
Useful additions for VM usability:
- Before running Bootcamp in VM, you must always unload (unmount) the Bootcamp partition first. You must also provide permission to access data on the disk (2nd and 3rd terminal commands in step 4)
- If you want this to happen automatically after entering the Mac, open a terminal and follow these steps:
sudo nano /etc/rc.local
- Enter the password and press Enter. Teminal will show a blank page.
- Enter the following lines into the terminal (change the number N in / dev / disk0sN to match the number of your bootcamp disk).
# grant VBox permissions to Bootcamp sudo chmod 777 /dev/disk0s4 diskutil unmount /dev/disk0s4
- Press Control + O, after Enter to save.
- Press Control + X to exit.
How To: Run Windows 7 (Bootcamp) in VirtualBox (original English topic)
"Click to show the spoiler - click again to hide ..."
Bootcamp is great and all, but ... the fact that we have to reboot is not!
Sometimes you want to do a little task that really has to be run on Windows or there's no alternative software for Mac, but you don't want to reboot into Bootcamp to do it. And you want to keep Bootcamp, since it lets you run Windows to its potential. Well, VirtualBox can certainly help you! It's a great piece of freeware that I recently fell in love with.
It lets you startup Windows 7 that you have on Bootcamp as a virtual machine ( VM
) relatively easy. So the data stays in sync whether you boot up from Bootcamp or VBox inside Mac OS (since it's really the same installation). Instead of creating a virtual hard disk file like normal virtual machine, it uses a small special file that essential let the VM access the real physical disk.
Install VirtualBox in Mac OS X.
Create New Virtual Machine, follow the step until you have to select Virtual hard disk
, leave it like that. The steps are,
Name your VM, select Windows 7, click Continue (I name mine “Bootcamp”)
Allocate Memory (Ram) for the VM (essentially, you should give at least 1 GB, 1024 MB), press Continue
Virtual Hard Disk, leave it like that for now, don't close it or anything, we'll do something else before continue.
Open Finder, go to Home Directory, look for folder named “VirtualBox VMs”, make sure it contains your VM folder (mine is Bootcamp).
Open Terminal (Applications> Utilities> Terminal) and type these commands,
press Enter / Return, then look under “/ dev / disk0? find the partition number associate with your VM (Bootcamp). It should be 4.
diskutil unmount / dev / disk0s4
If your number from previous command is not 4, replace it N with yours, in disk0sN. (Do the same in the next command)
sudo chmod 777 / dev / disk0s4
sudo vboxmanage internalcommands listpartitions -rawdisk / dev / disk0
Type it all in one line, and press Enter / Return
Type your Admin password (should be your own password). Nothing will show while you're typing the password, and it's normal, keep typing and make sure you type correctly. Then press Enter.
It will show a Partitions List. This time you'll not see their names. So make your paritition 4 (or whatever yours is) is the Bootcamp partition. (Compare the size) .
cd VirtualBox VMs / Bootcamp /
Type cd, space, then Virt and press tab, Terminal will automatically complete the folder name for you. Type Bootcamp (VM name) and press Enter.