Setting method VirtualBox Shared Folders

Article difficulty: Getting Started

surroundings:

软件环境:
VirtualBox:5.2.34
主机操作系统: Windows 7专业版 
虚拟机操作系统: Ubuntu 16.04 Desktop amd64
硬件环境:
CPU:Intel i5
内存:8G 

When using VirtualBox in Ubuntu virtual machine, we sometimes want to mount the Windows directory in Ubuntu virtual machines, file exchange between the two systems. Some students might ask, since you can drag and drop a two-way (between the two systems can refer to "solve the problem of VirtualBox in Ubuntu virtual machines and Windows can not drag and drop of two-way" ), then why should we spend way to mount the file system exchange documents? In fact, mount the Ubuntu file system, then you can directly use Linux commands to manipulate files in the directory, it is a very convenient means of communication. Classmate said, "I still find it convenient dragged ah." "Emmm ..."
Come on, we set up together with Li VirtualBox shared folder.
1 to be shared settings file in the Windows folder mainframe
confirm VirtualBox virtual machine is turned off , click "Settings."
figure 1
Into the "shared folders" setting interface, click on the symbol shown on the right box.
figure 2
Setting a shared folder as shown in FIG. In this example, we set up the shared folder is share files under the E disk VM directory folder. The name of this folder is Share. Click "OK" to close the dialog.
image 3
After the green box to confirm the information is correct, click "OK" back to the main screen.
Figure 4
2 Mount shared folders in Ubuntu virtual machine
boot Ubuntu virtual machine, enter the password, login system.
Figure 5
Enter key combination Ctrl+ Alt+ t, a terminal open, as shown below.
Figure 6
Entry

mkdir share_dir

This command creates a new file folder called share_dir.
Figure 7
Entry

ls -ld share_dir

来确认刚刚的命令已经成功。事实上,在Linux中,没有声音就是最好的声音,因此如果上一条命令没有返回错误信息,则上一条命令就执行成功了。如下图可以看到,share_dir目录已经新建成功了。
Figure 8
最后,我们使用mount命令将我们刚刚设置的共享目录挂载到Ubuntu里。这里,对Linux还比较陌生的同学可能对挂载不太能明白。可以学习一下网上别的帖子。Linux使用的挂载的方法来处理磁盘,十分灵活,和Windows的处理方法大相径庭。
输入

sudo mout -t vboxsf Share share_dir

这样就将Share这个共享文件夹挂载到当前目录的share_dir上去了。这里我简单的对这行命令进行说明。sudo是因为mount需要root权限。-t后面跟着所要挂载的文件系统类型,在这个例子里是vboxsf,这是VirtualBox共享文件的类型。share_dir表示挂载点。
注意,此时会让你输入密码。**输入密码时,是没有任何输出的!是没有任何输出的!是没有任何输出的!**千万不要觉得是死机了。你只要输入你的用户密码,并按Enter回车键就好。
Figure 9
自此以后,对share_dir这个挂载点中的文件做处理,就是对所挂载的共享文件夹里的文件进行处理
我们使用Shell命令在这个文件夹里新建一个文件,并在第一行打上“It’s a test”。

echo "It's a test" > share_dir/test.txt

执行结果如下图所示。
10
3 在Windows主机中检查执行结果
打开文件管理器,到共享文件夹E:\VM\share中点开test.txt,检查内容是否一致。
11
可以看到,和我们刚刚在Linux中新建时输入的内容一样。

验证成功!

You can in Windows, the files into the shared folder. Then, in Ubuntu, these files are processed. Go try it!

If you have any questions, welcome to leave a message! Feel useful, please support me point to praise Oh ~ Thank you!

Published 12 original articles · won praise 0 · Views 3788

Guess you like

Origin blog.csdn.net/jumpingpig/article/details/104109395