wewantbananas
wewantbananas

Reputation: 31

Unable to mount NFS shares on Windows clients

I have an NFS share set up on a Linux box. I have my recipe installing the NFS services for Windows and I am able to connect to the NFS share using the UNC path or mapping the drive. I can manually mount the share as well, using either mount or net use successfully. I'm trying to automate this with Chef but the same commands that work manually are not working when I Chef it. I've tried multiple methods and none have worked.

mount "X:" do
    device "\\\\d-devfs02.domain.com\\software"
    action :mount
end

ArgumentError: The network path was not found.

mount "X:" do
    device "d-devfs02.domain.com:/software"
    fstype "nfs"
    action :mount
end

ArgumentError: The parameter is incorrect.

execute "Mount" do
  command "net use X: \\\\d-devfs02.domain.com\\software"
  action :run
end

---- Begin output of net use X: \d-devfs02.domain.com\software ---- STDOUT: STDERR: System error 53 has occurred.

The network path was not found. ---- End output of net use X: \d-devfs02.domain.com\software ---- Ran net use X: \d-devfs02.domain.com\software returned 2

execute "Mount" do
  command "C:/Windows/System32/mount.exe \\\\d-devfs02.domain.com\\software *"
  action :run
end

---- Begin output of C:/Windows/System32/mount.exe \d-devfs02.domain.com\so ftware * ---- STDOUT: STDERR: 'C:/Windows/System32/mount.exe' is not recognized as an internal or exte rnal command, operable program or batch file. ---- End output of C:/Windows/System32/mount.exe \d-devfs02.domain.com\soft ware * ---- Ran C:/Windows/System32/mount.exe \d-devfs02.domain.com\software * returned 1

This one just blows my mind. Not only have I confirmed that the file exists in that location, this command (along with all the net use commands) work when I run them manually.

Net use and mount commands work when I do them manually. I'm running chef-client as myself so it is not a permissions problem. Chef-client cannot see mount.exe for some reason and net use has an issue with the path. I'm not sure what else to do here.

Upvotes: 3

Views: 2284

Answers (1)

Julian Dunn
Julian Dunn

Reputation: 286

Are you on a 64-bit Windows machine? This could be because the Ruby in Chef is a 32-bit Ruby, and so Windows' helpful "filesystem redirector" kicks in.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384187.aspx

In other words, the actual path as seen by the 32-bit Ruby is C:\Windows\Sysnative, not C:\Windows\System32.

Upvotes: 0

Related Questions