Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access share folder in virtualbox. Host Win7, Guest Fedora 16?

I'm a newbie in linux. I installed Fedora 16 OS as guest in virtualbox on Window 7. Now, I want to access share folder from Fedora. Here is something I did:

  • Install guest addtion [OK]
  • Make share folder link to virtualbox [OK]. Share folder path in Window 7: D:\share_folder_vm
  • In terminal program in fedora, I just run some commands:

    [hoangphi@localhost ~]$ su
    Password: 
    [root@localhost hoangphi]# cd Desktop/
    [root@localhost Desktop]# mkdir share_folder
    [root@localhost Desktop]# sudo mount -t vboxsf D:\share_folder_vm \share_folder
    /sbin/mount.vboxsf: mounting failed with the error: Protocol error
    [root@localhost Desktop]# 
    

I got this message: /sbin/mount.vboxsf: mounting failed with the error: Protocol error

share_folder_vm is the folder in Win7 Host and share_folder is the folder in Fedora Guest.

My question: How can I fix this problem?

like image 752
PhiVH Avatar asked Sep 11 '25 07:09

PhiVH


2 Answers

Install Oracle Guest Additions:

[host-hotkey (usually right Ctrl)] + [d],

Then:

sudo /media/VBOXADDITIONS_4.*/VBoxLinuxAdditions.run

You can now enjoy:

  • A guest that can run at native screen resolution
  • Ability to share files between host and guest
  • Share the clipboard (allowing you to copy and paste between host and guest).

To share folders set them up to be shared. Consider the permissions. Note that the host file permissions are transient. IOW if you can't write to file on host, the guest can't either.

After setting up the file to be shared create a destination if you don't have one: mkdir -p ~/destination

Now mount it under the name you configured it with:

sudo mount -t vboxsf myFileName ~/destination

As an extra tip you can really exploit this feature to do things like: - Use guest subversion client to create repository to mounted directory (you won't have a full svn client but the repo can be used in an IDE on the host). - I personally use my guest to download and unpack binaries like Tomcat to a targeted mount. Yes you can use Linux to install things on Windows!

To unmount all shares:

sudo umount -f -a -t vboxsf
like image 75
thejartender Avatar answered Sep 12 '25 22:09

thejartender


This thread has some great tips. However....

@GirishB's answer isn't correct - sorry. Jartender's is best.

Also, every post in here seems to assume you're logging in to the Linux guest as root, except for @tomoguisuru. Yuck! Don't use root, use a separate user account and "sudo" when you need root privileges. Then this user (or any other user who needs the shared folder) should have membership in the vboxsf group, and @tomoguisuru's command is perfect, even terser than what I use.

Forget running mount yourself. Set up the shared folder to auto mount and you'll find the shared folder - it's under /media in my OEL (RH and Centos probably the same). If it's not there, just run "mount" with no arguments and look for the mounted directory of type vboxsf.

Terminal showing 'mount' and where to find mounted shared folder

like image 40
Andrew Wolfe Avatar answered Sep 12 '25 22:09

Andrew Wolfe