特殊:Badtitle/NS100:VirtualBox/SharedFolders

来自Ubuntu中文
Wikibot留言 | 贡献2009年11月17日 (二) 21:05的版本
跳到导航跳到搜索
可打印版本不再受到支持且可能有渲染错误。请更新您的浏览器书签并改用浏览器默认打印功能。

{{#ifexist: :VirtualBox/SharedFolders/zh | | {{#ifexist: VirtualBox/SharedFolders/zh | | {{#ifeq: {{#titleparts:VirtualBox/SharedFolders|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:VirtualBox/SharedFolders|1|-1|}} | zh | | }}

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. :-)