Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What is the best way to share directories between Windows Vista host and Linux guest on VMPlayer?

The scenario is following:

  • on the Windows host I've got development tools (IDE, etc.);
  • on virtualized Linux I've got the test environment;
  • I need to share code directory between the two;
  • I'd prefer to have files served from Win to Lin, but if the other way around is more efficient, I consider switching.


Edit: should I use cifs rather then smbfs?

Edit2: Ok, my initial question was because I've done it "by the book". Mounted with smbmount. Was terribly slow, unusable. Then I've mounted with cifs. Didn't help. Now I've tried the ip option as suggested by Evan. No change. Is it about round trips to domain controller or something like that? Should I set up local account just for sharing?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

If your Linux guest has the SMB or CIFS filesystems available, you can mount shared directories on the host system (assuming you've configured networking between the VM and the host). (I'm a little sketchy on VMWare Player-- it's been a long time-- but I think it can do bridged networking between the host and the guest.)

The hardest part is going to be getting the Windows host's firewall opened up to allow file sharing. After that, assuming you can do:

mount //host-computer-name/sharename /mnt/mount-point-on-linux -t smbfs -o "ip=host-ip-address,username=valid-user-on-host"

By specifying the IP address on the mount command line you don't have to worry about name resolution between the host and the guest.

You can use either cifs or smbfs as the filesystem type, depending on which your kernel has. Both can co-exist in the same kernel w/o conflict. The smbfs code is the older code, but has always worked fine in my experience. The cifs code is newer, but has also worked when I've used it. Some people say that cifs performs better, but I can't say I've seen that. They have slightly different options semantics, so be sure to take that into account.

share|improve this answer
    
It that efficient enough? –  vartec Jul 7 '09 at 15:28
    
The SMB/CIFS protocol isn't the greatest in the world, but it should perform well for you. The alternative would be to setup an NFS server and client, and that's a lot more work for what probably won't amount to a lot better performance. I wouldn't go thru the hassle of trying to setup the Linux guest as the "server" because you're not going to see any substantial performance benefit and you'll be storing data inside the VM's disk (where it's harder to get at later). –  Evan Anderson Jul 7 '09 at 15:33
    
Thanks Evan. Well, actually I've went trough "the hassle" of setting up Samba server (isn't much hassle really). Don't really know why it doesn't work fine the standard way. Must be something with locking or something. –  vartec Jul 8 '09 at 8:41
    
I'm accepting this one, because it should work, so it is an answer to my initial question. Although it doesn't actually work for me. –  vartec Jul 8 '09 at 8:49
    
re: your edits - It's difficult to say why you were seeing poor performance w/o looking at it "eyes on". The only communication w/ a domain controller would be at the initial connection (to establish the security token on the machine serving the files). After that the connection is left open persistently. Setting up samba isn't really too bad, but not knowing if you'd done it before or not, I deemed it a "hassle". >smile< Sorry to hear that mounting the remote filesystem didn't perform well. I'd love to know why, but it's probably at the point of diminishing returns troubleshooting it now. –  Evan Anderson Jul 8 '09 at 13:12

If the Windows host don't need to access certain folders of the Linux guest, i would suggest you to run VMWare Shared Folders. This way you can share any folder of the windows host to Linux guest with read and write access. I have encountered problems with samba when suspending a guest Linux. This won't happend to shared folders from VMWare itself.

Another side effect is the security issue. I'm not sure about your setup but if you don't have the luxury of a private and safe LAN network its definitely safer to use Shared Folders. Those shared folders won't be seen from the outside network connected to the Windows Host or Linux Guest.

You can use the Open VM Tools -> http://open-vm-tools.sourceforge.net. The setup is very easy but depends on the distribution you're running as a guest. The Package should be included in most Distribution around. I know for sure its least included in Arch, Ubuntu or Gentoo.

share|improve this answer

You can share the code directory on the windows host and mount it with Samba in the linux guest.

share|improve this answer

I still don't know why the standard way works so terribly slow.

The solution for me was to set up Samba server on Linux, than mount it in Windows. Works just fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.