You are not logged in.

#1 2016-09-02 18:49:31

sxlijin
Member
Registered: 2016-08-30
Posts: 8

Making symlinks work on Win7 CIFS share

Context: I'm running a Windows 7 Pro host with Arch in a VBox VM, and I'm trying to set up file sharing between the two. Specifically, I have a separate physical drive (NTFS) on my host that I'm using for files, data, etc.

So far, the best I've been able to do is use Windows' native shared folder feature to share the physical drive with the VM and mount it in Arch as a CIFS share. Unfortunately, this seems to cause some problems with symlinks, and I'd really like to be able to use symlinks.

Other things I've tried:

  • I can't get anywhere with setting up the drive as a NFS share (can't get FreeNFS or HaneWIN working, and Cygwin NFS is in a really weird upstream state).

  • Setting the drive up as a VBox shared folder completely borks file permissions because the vboxsf driver is abysmal.

  • Giving the VM direct access to the drive via a VMDK causes really weird issues with Windows that I don't even want to try to touch.

I've gone in and adjusted the Windows security policy to allow my account to make symlinks on the drive, and

mklink

works in

cmd

on Windows. Hell, symlinks I make in

cmd

even show up as symlinks in the CIFS share.

On the Arch side, though, I simply can't figure out how to get symlinks working.

user@arch:~$ sudo mount -t cifs //$serverip/share /share -o noauto,credentials=/etc/cifs.conf,uid=$uid,gid=$gid,iocharset=utf8,rw,x-systemd.automount
user@arch:/share$ touch foo
user@arch:/share$ ln -s foo bar
ln: failed to create symbolic link 'bar': Operation not supported

The SFU option doesn't even work, and I have no idea what it's doing that causes this:

pockets@x220-arch-x64:~$ sudo mount -vt cifs //$serverip/share /share -o noauto,credentials=/etc/cifs.conf,uid=$uid,gid=$gid,iocharset=utf8,rw,sfu,x-systemd.automount
Credential formatted incorrectly: (null)
mount.cifs kernel mount options: ip=$serverip,unc=\\$serverip\share,iocharset=utf8,sfu,uid=$uid,gid=$gid,user=$user,pass=********
mount error(20): Not a directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I can't figure out how to check if the share supports CIFS Unix Extensions, which seems to control a lot of behavior, but evidently it doesn't seem to do anything by default.

I'd love any ideas about what to do about this, or even suggestions for some alternative file sharing solution.

Offline

#2 2016-09-02 19:12:14

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: Making symlinks work on Win7 CIFS share

You should be able to use shared folders instead of CIFS.  https://wiki.archlinux.org/index.php/Vi … ed_folders
Is the vboxsf kernel module loading on the guest?  Check with lsmod
Is your user part of the vboxsf group?

Even so, I don't think that symlinks are going to work with NTFS.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-09-02 19:49:08

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: Making symlinks work on Win7 CIFS share

NTFS symlinks don't even work well over CIFS on Windows. Have you tried navigating to a CIFS share in the Windows cmd and using mklink? The actual problem is, that ln probably doesn't understand neither CIFS nor NTFS well enough to create the symlink. Trying to search for a solution on Google is almost painful.

What I would do:
1. Set up some sort of remote server (cygwin SSH for example).
2. Write a small script, that ssh user@host; navigate to target; cmd.exe /c mklink /j name target with relative paths. Do as much path conversion magic as you feel capable of.
3. /usr/local/bin/cifsmklink user@host relative paths
4. Get tired of writing user@host (because it's like the Highlander, there can be only one) and either hardcode it in a variable in the script, use an environment variable (sexy, because you can use it for other hacks), or read it from a dotfile (because you were always curious, how that works in bash).
5. 3. /usr/local/bin/cifsmklink relative paths.
6. Find it amazing, create project on github.
7. Write PKGBUILD and upload to AUR.
8. Read threads about people trying to symlink over CIFS and smile.
9. Read threads that go like "cifsmklink doesn't work. I type "yaour -Syyau cifsmklink-git" and my dog explodes."
10. Tell me how it all worked out for you.

EDIT: Dafuq, ewaller, I could swear I was alone in this thread!
EDIT: Did I really just spend half an hour doing research and writing my post? Oh my ...

Last edited by Awebb (2016-09-02 19:51:09)

Offline

#4 2016-09-10 17:53:09

sxlijin
Member
Registered: 2016-08-30
Posts: 8

Re: Making symlinks work on Win7 CIFS share

Thanks for the replies!

@ewaller: appreciate the shared folder push; I had originally pushed it aside in my head because the vboxsf driver makes controlling permissions on a granular level a bit difficult, but since I'm only using the VM for my personal work, it's a better trade-off than the CIFS tradeoff.

@awebb: thanks for the suggestion! I'll add it to the list of personal projects that I might actually get around to someday smile

Offline

Board footer

Powered by FluxBB