Folder Shares with XP host-Linux/2k3 guests

Discussions related to using VirtualBox on Windows hosts.
PeteD
Posts: 9
Joined: 4. Dec 2007, 00:20

Folder Shares with XP host-Linux/2k3 guests

Post by PeteD »

Hi All

Like alot of people, not being an expert in all things Linux, I had some problems getting the shared folders to work between the Host and Guest OS's using the VBoxAdditions.

I've eventually sorted out the shared folder mounting in Ubuntu 7.10, using the following commands in a terminal window.

sudo mkdir sharename
sudo mount.vboxsf sharename ~/sharename


All other commands I had seen in other posts had refered to the mount -t command which resulted in Protocol errors.

For openSUSE 10.3, although the shared folders were also in the home folder, the commands were slightly different;

su [enter root password]
mkdir sharename
mount.vboxsf sharename sharename


I could then access files from the Host OS in the Guest OS. MP3 and Xvid files played with no problems.

Both Ubuntu and openSUSE seem to lose the mounting of the shares after a re-boot. I've created executable scripts to quickly get round this problem after I boot into them. Is this a general Linux issue or a Virtual Box one??

I have also setup a Windows 2003 Server Guest OS. The installation and setup of shares in this Guest is much simpler and the 'mapping' persists between re-boots. I have one problem though. I can't play MP3 or Xvid files when accessing them directly on the shared folder. Windows (WMP) errors saying it cant open the file. I can't copy and paste files to the local C drive with right mouse click or via the menus, but I can drag and drop them. Once copied over, they play. Viewing photos on the shared folders or even installing software from them works ok.

Any ideas??

Thanks.

Pete
Aliby
Posts: 24
Joined: 16. Jul 2007, 10:33
Location: Midrand, South Africa

Re: Folder Shares with XP host-Linux/2k3 guests

Post by Aliby »

PeteD wrote: ...
Both Ubuntu and openSUSE seem to lose the mounting of the shares after a re-boot. I've created executable scripts to quickly get round this problem after I boot into them.
...
Hi Pete

I am not a Linux fundi and have much to learn.

Would you mind walking me through creating an executible script that can do this? Much appreciated

Aliby


:?
VirtualBox 1.5.6
Host: Windows XP
Guest: UbuntuStudio 7.10 / Windows XP
PeteD
Posts: 9
Joined: 4. Dec 2007, 00:20

Post by PeteD »

Hi Aliby

For Ubuntu, create a file in your home folder and call it 'mountshares' or whatever you like. Then copy in the following and then make it executable following the instructions in the comments.

Code: Select all

# File Name: mountshares
# This will mount the Vbox shared folders.
# To make this file executable, open a terminal window
# and type the command: chmod +x mountshares
# 
# To run the file, open a terminal window and type:
#   sh ./mountshares
# or double clicked on it in a file manager.
# It will ask for the root password then mount the shares

sudo mount.vboxsf Data ~/Data
sudo mount.vboxsf Media ~/Media
For OpenSUSE

Code: Select all

# File Name: mountshares
# This will mount the Vbox shared folders.
# To make this file executable, open a terminal window
# and type the command: chmod +x mountshares
# 
# To run the file, open a terminal window and type:
#   sh ./mountshares
# or double clicked on it in a file manager.
# It will ask for the root password then mount the shares

su
mount.vboxsf Data Data
mount.vboxsf Media Media
I find that in OpenSUSE, after typing the root password, the rest of the file doesn't actually run properly, but pressing the up arrow to list the last command (to get to the mount statements) and pressing enter does the job, and is quicker than typing it all out.

I haven't tried forcing these files to auto-run and startup yet as I've read in other posts that people have tried without much success.

I notice from your sig that you run XP as a guest, under an XP host. Have you got shared folders to work properly with that setup?? I'm still having problems with XP and 2K3 Server as a guest OS. I'm going to try on another PC with XP as the Host to see if I get different results.

Cheers.

Pete
Aliby
Posts: 24
Joined: 16. Jul 2007, 10:33
Location: Midrand, South Africa

Post by Aliby »

Hi Pete

My Shares across the Host and Guest Windows XP is working perfectly using the command:

Code: Select all

net use M: \\vboxsrv\Data
XP maintains this mapping on reboot as well which is great.

I can't recall if the clipboard across the two works or if drag-n-drop works. I'll get back to you on those.

CU
VirtualBox 1.5.6
Host: Windows XP
Guest: UbuntuStudio 7.10 / Windows XP
PeteD
Posts: 9
Joined: 4. Dec 2007, 00:20

Post by PeteD »

I can also get the shares to be available and accessible when setting them up via a command prompt with the net use command. They are also persistent.

The problem I have is playing media files off of the shared folders, especially with Windows Media Player. It just can't do it! I have had partial success with Winamp when playing MP3s but this still hangs occasionally. Copying media files to the guest OS local C dive results in successful playing of said files.

What is very strange is I get the exact same problem with 3 different PC's, all XP host with XP guest.
Linux has no such problems with shared folders on any of the PC's apart from losing the mounting of the shares between re-boots. Also, I tried VPC from Microsoft with Vista as a guest under XP host, and got exactly the same problem. It seems that there is a major bug with the way MS OS's handle shared folders for media files, or with streaming from them. Any other file type is opened, or executed with no problem.

Could you try playing an MP3 in your XP guest with WMP and let me know if it works?

I've ditched shared folders for MS OS's and now use virtual NICs bridged to the real one on the Host PC, although I'd like to just use shared folders as it's a much cleaner solution (if it ever works).

Thanks.

Pete
Aliby
Posts: 24
Joined: 16. Jul 2007, 10:33
Location: Midrand, South Africa

Post by Aliby »

Hi Pete,

Tried using WMP - adds it to the play list, but errors with "Can't find the specified file" ... same with MP3 and DivX AVI's

Using VLC (http://www.videolan.org) it works fine with both media types (probably all) with no lags or delays.

I haven't tried bridging the two Network devices and using the host machine ID to access the shared folder - this may be somewhat better with both the windows and linux guests as it is a "conventional" network access method? What are the downsides?
Last edited by Aliby on 8. Jan 2008, 09:39, edited 2 times in total.
VirtualBox 1.5.6
Host: Windows XP
Guest: UbuntuStudio 7.10 / Windows XP
PeteD
Posts: 9
Joined: 4. Dec 2007, 00:20

Post by PeteD »

Hi Aliby

Thanks for the info. Hopefully, these liitle issues with Shared folders will get fixed in a future update.

Cheers.

Pete
Knersis
Posts: 1
Joined: 6. Aug 2008, 10:50

Well that worked

Post by Knersis »

I also had the Protocol error using the following command:

sudo mount -t vboxsf Downloads /mnt/Downloads/

What i noticed was the post about changing the share to starting a small caps.

Well I changed it from Downloads to downloads and then changed the command line to:

sudo mount -t vboxsf downloads /mnt/Downloads/

That worked perfectly, this is running Windows Vista 32 as host, with Ubuntu 8.04 as guest OS.
abrenecki
Posts: 1
Joined: 24. Nov 2008, 09:18

Post by abrenecki »

To get a volume to mount on boot, you need to edit the filesystem table, located at /etc/fstab. To do this, type

Code: Select all

sudo nano /etc/fstab
at Terminal in Linux. The format for a fstab entry is

Code: Select all

 <file system> <mount point> <type> <options> <dump> <pass>
so you would need to add

Code: Select all

sharename /media/sharename vboxsf defaults 0 0
to mount a share callec "sharename" at /media/sharename. Then, to save the fstab, press Ctrl+O, Enter, then Ctrl+X to exit.
davoura
Posts: 37
Joined: 20. Sep 2008, 00:45
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: various linux distros and Windows versions

Post by davoura »

abrenecki wrote:To get a volume to mount on boot, you need to edit the filesystem table, located at /etc/fstab. ....you would need to add

Code: Select all

sharename /media/sharename vboxsf defaults 0 0
to mount a share callec "sharename" at /media/sharename.
I tried this but it would not work for me, I got the protocol error when using "sudo mount -a".

I did however have great success in using the
sudo mount.vboxsf sharename ~/sharename
command in a terminal.

My host is Ubuntu, my guest is Ubuntu 8.04, and I want to have the shared folders mounted at every boot of the virtual machine rather than having to enter the right commands each time.

so what entry for fstab actually works for Ubuntu?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

That entry should work, of course with the proper modifications to reflect your own situation. If that fails, you can always enter the mount command in /etc/rc.local. Make sure that you add a few options too, else you won't be able to write to the shared folder. The options are uid=1000,gid=1000,rw,exec, that will make your user the owner and group of every file, have read and write options and you can execute files (like scripts).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Telescope
Posts: 3
Joined: 12. Mar 2009, 14:44

Re: Folder Shares with XP host-Linux/2k3 guests

Post by Telescope »

I can't edit files in shared folders:
sudo mkdir /mnt/share
sudo mount.vboxsf -o uid=1000,gid=1000 vs /mnt/share
or
sudo mount -t vboxsf vs /mnt/share -o rw,exec,uid=1000,gid=1000,dev

$ echo blubb > /mnt/share/New

ls -l /mnt/share
-rw-rw-rw- 1 usr usr 31 2009-03-11 18:24 New

gedit /mnt/share/New - can't save changes.

(But nano do it!)

How to edit files in shared folders with gedit?

Thank you!
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Folder Shares with XP host-Linux/2k3 guests

Post by vbox4me2 »

gedit probably creates temp files that are like "~temp222" or contain other characters in its (temp)filename that are problamatic to the vbox sharing engine.
Telescope
Posts: 3
Joined: 12. Mar 2009, 14:44

Re: Folder Shares with XP host-Linux/2k3 guests

Post by Telescope »

Thank you! But unfortunately.
I switch off this option but get error again.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Folder Shares with XP host-Linux/2k3 guests

Post by vbox4me2 »

It is a known issue, these vbox shares are nice if you don't have anything else at hand, it would be better to use real windows file sharing.
Post Reply