In my new job, I am using Virtual Box from Oracle for presentation demos, testing and learning more about SQL Server. When I was at Microsoft, I used Hyper-V for all of that. Hyper-V is a great solution for virtualization, but it is a real pain for running demos and testing on a laptop. Virtual Box runs on Windows 7 which is why I am using it now instead of Hyper-V.
One of the first things I had to figure out when using Virtual Box, was how to copy files from my laptop, onto the virtual machines (VMs). Maybe I have a difficult time following directions, but I just could not get it to work from the information I found in the provided help files or anything I found online. Eventually, I came up with a really easy method which I would like to share with you today! NOTE: I have only tried this with Windows operating systems so it may not work on other operating systems.
To get started with Virtual Box, you can download it here. If you plan to run 64 bit VMs, and I know you are, you also have to enable Virtualization Technology in the BIOS of your host machine.
So, let’s skip to the point where you have a VM running and you want to copy some files that are not in ISO format to the VM. The first step is to make sure that the Guest Additions (Figure 1) have been installed. You can find these under the Devices menu. After installing the Guest Additions, you’ll have to restart the VM.
Figure 1: Install Guest Additions
Once the VM is running again, run Shared Folders, also found in the Devices menu. Click the icon to add a folder (Figure 2).
Figure 2: The Shared Folders dialog box
This brings up the Add Share dialog box (Figure 3) where you can browse to a drive or folder on the host by selecting Other. The folder on the host does not have to be a share; it can be any folder, even My Documents.
Figure 3: Add the share
Set the other properties on the dialog as required and click OK. Click OK once more to close the Shared Folders dialog. Now open an Explorer window in your VM and navigate to Network. Under Network you should see VBOXSVR. You may need to enable network file sharing if you can’t see it. By selecting VBOXSVR, you should see the share you created (Figure 4).
Figure 4: View the new share
That's all there is to it! Now you can copy files easily to your VM.