This page has been robot translated, sorry for typos if any. Original content here.

How to start Windows 7 (Bootcamp) in VirtualBox

On this topic:


Как запустить Windows 7 (Bootcamp) в 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 software for the Mac, but you do not want to reboot into BootCamp. Or you want to switch as fast as possible between operating systems ... VirtualBox can certainly help you! This is a really tasty piece of free (freeware) software in which one should fall in love and learn how to use it. Just say - 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 the work of Windows 7 at any time, which will allow you to run Windows from the place where you finished. Thus, the synchronized data remains inside the Mac OS. And most importantly - Instead of creating a virtual hard disk file like a normal virtual machine, it uses a small special file, which is much more convenient.

Step-by-step instruction

  1. Install VirtualBox ( VM ) on Mac OS X.
  2. Create a new Virtual Machine. Follow these instructions until you select Virtual hard Disk:
    • - Name your VM, select Windows 7, click the Continue button (I called "Bootcamp")
    • - Select the memory (RAM) for the virtual machine (at least put at least 1 GB, 1024 MB) and click Continue.
    • - Now leave everything as is, do not close anything, we will do something else before continuing ...
  3. Open the Finder, go to the main page, look at the folder named "VirtualBox VMs", make sure it contains the folder of your virtual machine (I have this Bootcamp).
  4. Open the terminal ( Applications> Utilities> Terminal ) and enter the following commands diskutil list Press Enter / Return, in the "/ dev / disk0" section you need to find the partition number associated with the VM (Bootcamp). This 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 last and next command) sudo chmod 777 /dev/disk0s4 sudo vboxmanage internalcommands listpartitions -rawdisk /dev/disk0 Enter all this in one line and press Enter / Return.
    • - Enter the administrator password. Entering the password does not appear on the screen at all, this is normal, keep typing and make sure that you enter correctly. Then press Enter / Return.
    • - 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 partition (Compare size).
    cd VirtualBox VMs/Bootcamp/ cd space followed by 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 Type all this in one line and press Enter / Return.
    • - If the process was successful. It will show "RAW host disk access VMDK file win7.vmdk created successfully".
    • - Return to the Finder, browse the Bootcamp folder (VM folder). It should have win7.vmdk and win7-pt.vmdk.
    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.
  5. Return to VirtualBox. Select Use an existing hard disk and click the yellow folder on the right, find and select the win7.vmdk that you created, and then click Next.
  6. VirtualBox appears on the Summary page after click Done.
  7. Open the settings of the created VM to customize 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 share files between the Mac and Windows when you start the virtual machine. Do not forget to check the automatic mount.
  8. Start the VM.
    • - Install Guest Additions (select from the menu in the Mac while working with the virtual machine) Device> Install Guest Additions , afterwards a virtual CD will appear in Windows 7. Install and restart the virtual machine.
    • - After reboot, if the shared folder does not appear, select Mount network drive on the toolbar and locate the shared folder and check the Restore on logon box.
    • - If you use VBox's Seamless Mode, this is the mode that runs Windows applications on the Mac as native.

  9. Useful add-ons for ease of use VM:
    • - Before running Bootcamp in the VM, you should always unmount the Bootcamp partition first. Also, you must grant permission to access the data on the disk (the 2nd and 3rd terminal commands in step 4)
    • - If you want this to happen automatically after you log in to the Mac, open the terminal and do the following:
    • sudo nano /etc/rc.local
    • - Enter the password and press Enter. Teminal will display a blank page.
    • - Enter the following lines in the terminal below (change the number N to / dev / disk0sN to match the number of your Bootcamp drive).
    • # 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.
  10. Done!

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 thing that really has to be run on Windows or there's no alternative software for Mac, but you do not 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, the virtual hard disk is used.

Step-by-step guide:

  1. Install VirtualBox in Mac OS X.
  2. 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, do not close it or anything, we'll do something else before continue.
  3. Open Finder, go to Home Directory, look for folder named "VirtualBox VMs", make sure it contains your VM folder (mine is Bootcamp).
  4. Open Terminal (Applications> Utilities> Terminal) and type these commands,
    •   diskutil list 

      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 the previous command is not 4, replace it 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.

    •   sudo vboxmanage internalcommands createrawvmdk -rawdisk / dev / disk0 -filename "win7.vmdk" -partitions 4 

      Type it all in one line, and press Enter / Return

      • If the process is successful. It will show "RAW host disk access VMDK file win7.vmdk created successfully."
      • Go back to Finder, look inside Bootcamp Folder (or your VM folder) that win7.vmdk and win7-pt.vmdk are there.
        .
    •   sudo chown (username) win7 * .vmdk 
      • Replace (username) with your Account name (If you're not sure, type whoami in Terminal and press Enter).
      • Press Enter and type your password.
        .
  5. Go back to VirtualBox. Select Use existing hard disk and click the yellow folder on the right side to find and select the created win7.vmdk, and click Continue.
  6. VirtualBox will present you a Summary page, click Done.
  7. Open up Settings of the created VM, configure the settings to your liking.
    • Network: you should select the Bridge Adapter, and the network interface you use to connect to the Internet.
    • Shared Folders: select a folder, so you can share files between Mac and Windows while running the VM. Do not forget to tick Auto-mount.
      .
  8. Start up the VM.
    • Install Guest Additions (Select from Menu Bar in Mac while running the VM) Device> Install Guest Additions, then in Windows 7, a virtual CD will be there. Install and restart the VM.
    • After restart, if the Shared Folder does not show up in the Computer, click Map network drive in Toolbar and look for your Shared Folder and tick. Reconnect at login.
    • If you use VBox's Seamless Mode, it'll be like this.
      .
  9. Back to Mac OS, this is what you need to know.
    • Before starting up Bootcamp in VM, you'll always have to unmount Bootcamp partition first. Also you have to grant permission to access the data on the disk. (2nd and 3rd Termianl commands in step 4)
    • If you want to login to a Mac account, open up the Terminal and follow the steps,
        sudo nano /etc/rc.local 
      1. Type your password, Enter. Teminal will show a relatively blank page.
      2. Type these lines in (change N number in / dev / disk0sN to match your Bootcamp disk)
          # grant VBox permissions to Bootcamp
         sudo chmod 777 / dev / disk0s4
         diskutil unmount / dev / disk0s4 
      3. Press Control + O, and Enter to save chanegs.
      4. Press Control + X to exit.
  10. End of Story