个人工具

“UbuntuHelp:VirtualBox/SharedFolders”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(创建新页面为 '{{From|https://help.ubuntu.com/community/VirtualBox/SharedFolders}} {{Languages|UbuntuHelp:VirtualBox/SharedFolders}} Note: Before trying to mount/map shared folder you must ins...')
 
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/VirtualBox/SharedFolders}}
 
{{From|https://help.ubuntu.com/community/VirtualBox/SharedFolders}}
 
{{Languages|UbuntuHelp:VirtualBox/SharedFolders}}
 
{{Languages|UbuntuHelp:VirtualBox/SharedFolders}}
Note: Before trying to mount/map shared folder you must install Guest Additions (run machine and choose "Install Guest Additions" form Device menu of machine window.
+
== Required: Virtualbox Guest Additions ==
 +
Before trying to mount/map shared folder you must install '''Guest Additions''' (run machine and choose "Devices" -> "Install Guest Additions" from the menu.
 +
=== Linux guest ===
 +
If you are running a Linux guest, open a terminal and type:
 +
<pre><nowiki>
 +
cd /cdrom
 +
</nowiki></pre>
 +
then, if you have 32 bit system:
 +
<pre><nowiki>
 +
sudo sh VBoxLinuxAdditions-x86.run
 +
</nowiki></pre>
 +
or
 +
<pre><nowiki>
 +
sudo sh VBoxLinuxAdditions-amd64.run
 +
</nowiki></pre>
 +
if you have a 64 bit system.
 +
Make sure you have the image VBOXADDITIONS mounted as cdrom before installing it.
 
Note: The client OS can not be open when adding share.
 
Note: The client OS can not be open when adding share.
 +
You will have to '''reboot''' the guest machine.
 +
== Prepare host ==
 
On the host (ubuntu) computer, run
 
On the host (ubuntu) computer, run
 
<pre><nowiki>
 
<pre><nowiki>
第9行: 第27行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Where "XP" is the name of the virtual machine in [[UbuntuHelp:VirtualBox|VirtualBox]], and "share" is the name of the share as the guest machine will see it. The hostpath must be a fully-qualified path.
 
Where "XP" is the name of the virtual machine in [[UbuntuHelp:VirtualBox|VirtualBox]], and "share" is the name of the share as the guest machine will see it. The hostpath must be a fully-qualified path.
 +
== Prepare guest ==
 +
=== Windows ===
 
On the Windows client, run
 
On the Windows client, run
 
<pre><nowiki>
 
<pre><nowiki>
 
net use x: \\vboxsvr\share
 
net use x: \\vboxsvr\share
 
</nowiki></pre>
 
</nowiki></pre>
If the client is Linux, run
+
=== Linux ===
 +
If the client is Linux, you have to mount and connect it to a folder.
 +
Run
 
<pre><nowiki>
 
<pre><nowiki>
 
mount -t vboxfs share mountpoint
 
mount -t vboxfs share mountpoint
第26行: 第48行:
 
</nowiki></pre>
 
</nowiki></pre>
 
See Section 4.4 Folder Sharing in the [[UbuntuHelp:VirtualBox|VirtualBox]] documentation.
 
See Section 4.4 Folder Sharing in the [[UbuntuHelp:VirtualBox|VirtualBox]] documentation.
 +
== Troubleshooting ==
 +
<pre><nowiki>
 +
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
 +
</nowiki></pre>
 +
The above error could be one of the following.
 +
=== Reinstall Guest additions ===
 +
Virtualbox Guest Additions have to be reinstalled after some updates.
 +
So install them as mentioned on the top of this wiki page.
 +
=== Reboot ===
 +
Did you reboot? You have to!
 +
=== WRONG: same name for shared folder / mount point ===
 +
'''Do NOT''' use the same name for the mount-point folder.
 +
The following example is '''WRONG''':
 +
<pre><nowiki>
 +
$ cd Desktop
 +
$ sudo mkdir shared
 +
$ sudo mount -t vboxsf -o uid=1000,gid=1000 shared shared/
 +
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
 +
</nowiki></pre>
 +
The following example is '''CORRECT''':
 +
<pre><nowiki>
 +
$ cd Desktop
 +
$ sudo mkdir ubuntushared
 +
$ sudo mount -t vboxsf -o uid=1000,gid=1000 shared ubuntushared/
 +
</nowiki></pre>
 +
As you can see, there is no error now. :-)
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年11月17日 (二) 21:05的版本

Required: Virtualbox Guest Additions

Before trying to mount/map shared folder you must install Guest Additions (run machine and choose "Devices" -> "Install Guest Additions" from the menu.

Linux guest

If you are running a Linux guest, open a terminal and type:

cd /cdrom

then, if you have 32 bit system:

sudo sh VBoxLinuxAdditions-x86.run

or

sudo sh VBoxLinuxAdditions-amd64.run

if you have a 64 bit system. Make sure you have the image VBOXADDITIONS mounted as cdrom before installing it. Note: The client OS can not be open when adding share. You will have to reboot the guest machine.

Prepare host

On the host (ubuntu) computer, run

mkdir ~/VirtualBoxShare
VBoxManage sharedfolder add "XP" -name "share" -hostpath /home/your/shared/folder/VirtualBoxShare/

Where "XP" is the name of the virtual machine in VirtualBox, and "share" is the name of the share as the guest machine will see it. The hostpath must be a fully-qualified path.

Prepare guest

Windows

On the Windows client, run

net use x: \\vboxsvr\share

Linux

If the client is Linux, you have to mount and connect it to a folder. Run

mount -t vboxfs share mountpoint

For the above command if you get error as

mount: unknown filesystem type 'vboxfs'

Then just change the vboxfs to vboxsf means the command will be

mount -t vboxsf share mountpoint

See Section 4.4 Folder Sharing in the VirtualBox documentation.

Troubleshooting

/sbin/mount.vboxsf: mounting failed with the error: Protocol error

The above error could be one of the following.

Reinstall Guest additions

Virtualbox Guest Additions have to be reinstalled after some updates. So install them as mentioned on the top of this wiki page.

Reboot

Did you reboot? You have to!

WRONG: same name for shared folder / mount point

Do NOT use the same name for the mount-point folder. The following example is WRONG:

$ cd Desktop
$ sudo mkdir shared
$ sudo mount -t vboxsf -o uid=1000,gid=1000 shared shared/
/sbin/mount.vboxsf: mounting failed with the error: Protocol error

The following example is CORRECT:

$ cd Desktop
$ sudo mkdir ubuntushared
$ sudo mount -t vboxsf -o uid=1000,gid=1000 shared ubuntushared/

As you can see, there is no error now. :-)