How to share information between Win7 and Ubuntu14.04 installed in Virtualbox

Source: Internet
Author: User
Tags oracle vm virtualbox vm virtualbox

How to share information between Win7 and Ubuntu14.04 installed in Virtualbox

Virtual machines are essential tools for every programmer. Based on the prompts in the latest VirtualBox user manual, this article provides three methods for sharing information between the Win7 system and Ubuntu 14.04 running in VirtualBox 5.0.2, instead of creating shared folders.

We often install virtual machines and install different operating systems for the purpose of saving hardware while learning new technologies or performing different tests. The operating system running on the hardware is called the master operating system (host OS), and the operating system running on the virtual machine is called the guest operating system (guest OS ). At this time, it is necessary to share information between host OS and guest OS.

With the help of [document] [1], This article summarizes the following methods for sharing information between Host OS and Guest OS with my own exploration and practice.

Environment Settings:

Host OS: Windows 7 VirtualBox: version 5.0.2 Guest OS: Ubuntu 14.01 prerequisites

One of the following prerequisites is to first install the Guest Addition of VirtualBox ). This function is not installed by default when VirtualBox is installed. It is equivalent to a software installed on Guest OS, so as to enhance communication between the Host OS and it.

The installation method is as follows: first start Guest OS; on the menu bar above the window for running Guest Host in VirtualBox, selectDevice (Devices)->Install enhancementsThen, Terminal in Guest OS (Ubuntu 14.04 at this time) will be automatically started, and you will be prompted to download the installation package. You can simply install the corresponding prompt.

With the installation of guest operating system enhancement features, we will provide a variety of features. Next we will introduce how to share information between them.

2 methods for sharing information between the two parties 2.1 Clipboard sharing

This is a method for clipboard sharing. You only need to copy one piece of information in one of the systems, and then obtain the information on the clipboard of the other system.

If your Guest OS is running, follow the method and select different options as needed.
If the Guest OS is not running, run VirtualBox.
2.2 Temporary shared folder Method

This method is only applicable to running Guest OS. Shut down Guest OS. After restart, the previously created shared file will become invalid. This method is flexible and is a temporary connection and sharing.

The method is as follows:

Click Devices-> Shared Folders-> Shared Folders SettingsSuch:
In the new dialog box (for example), click Add (for example, label 1), and then in the new Add Share dialog box (medium label 2) enter the path and name of the folder (do not select the three check boxes). For more information, see:

Start Terminal in Guest OS Ubuntu and enter the following command:

mkdir mntsudo mount -t vboxsf UbuntuShareFile mnt

First, create a folder mnt in the user directory, and then use the common load command to associate the folder javastusharefile on the Host OS with it.

2.3 automatically share folders

The methods described in section 2.2 disable Guest OS, and the created shared folder becomes invalid, which is sometimes inconvenient. This requires a method that permanently exists after a shared folder is created, this is the method described in this section.

The method is as follows:

Create a shared folder with the automatic connection function on the Host OS. You can use VirtualBox GUI or the command line tool VBoxManage. When creating a shared folder through GUI, enter the folder name and path of the folder and selectAuto-mountCheck box. The VBoxMange command is:

VBoxManage sharefolder add "Ubuntu" --name "UbuntuShareFile" --hostpath "E:\UbuntuShareFile" --automount

The same effect can be achieved in GUI methods. Note: To run the preceding command, you must switch to the folder where VBoxManage is located and run it in cmd of Win7.

VirtualBox specifies that the automatically connected shared folder corresponding to Host OS in Guest OS is in the path/media, at the same time, the name of the shared folder is the name of the shared folder on the Host OS with the prefix sf _. For example, in the above example, the name of the folder automatically created by VirtualBox in Ubuntu is sf_javastusharefile. For the above example, as shown in:

At this point, if you click to enter the file, you will find that you do not have the permission to browse any content in the folder, this is because

Access to auto-mounted shared folders is only granted to the user group vboxsf.

Therefore, you must enter the following command in the Terminal of Ubuntu to obtain the read and write permissions of the folder:

sudo usermod -a -G vboxsf robert

The preceding command adds user robert to user group vboxsf. If the command does not take effect after execution, you need to rewrite and start the Guest OS system.

In this way, you can smoothly access the content in the shared folder, instead of setting a new shared folder every time.

3 conclusion

No matter what type of virtual machine technology you use, sharing information between Host OS and Guest OS is always a topic. For example, in the Application Scenario of method 1, you run a program that complies with the C ++ 11 standard on Win7, but the operation fails, then you want to change the compiler g ++ to run the program again. It seems that the reason for the program is the compiler. The following two methods provide convenience for sharing large-capacity files.

It seems easy at first, but there are a lot of details to take care. Do not understand how to use VirtualBox, or be familiar with Terminal usage on Host OS and Guest OS. By sharing information between the Host OS and the Guest OS, I realized that some problems were caused when you did not get an answer after searching the Internet for a while, the best way is to directly read the User Manual of the software related to the problem.

[1]: Oracle Corporation. Oracle VM VirtualBox User Manual Version 5.0.2, 2015.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.