7

I've just literally spent about 2 hours trying to simply mount a windows share on linux.

Mounting with cifs causes deadly hangs as discussed here.

So I tried to mount via nfs as discussed in this page.

I spent a few minutes searching the nfsshare program, until I realized I had to install Unix Services for Windows.

After downloading the huge file, I was deterred by Microsoft's scare tactic: this program has known compatibility issues, and the subsequent, setup has detected that a required System Service (TCP/IP) is not currently installed...

This is even after I enabled the Simple TCP/IP services from Turn Windows features on or off.

Running

$ sudo mount -t nfs 192.168.1.76:myshare ~/mount3/

on Debian unfailingly gives me:

mount.nfs: access denied by server while mounting 192.168.1.76:myshare

Even though I've opened read, write, full to everyone under windows for the share in question.

$ sudo showmount -e 192.168.1.76

usually gives me:

rpc mount export: RPC: Procedure unavailable

or sometimes:

clnt_create: RPC: Unable to send

I tried using freeNFS.exe, while still getting the access permission error on Debian. I tried using haneWIN, which fails with Failed to start PortMapper.

4
  • 1
    Why don't you mount using cifs? The hangs you linked to were caused by the server being down and they can be easily avoided by using autofs or just unmounting with umount -fl as shown in the accepted answer. I mount various things with cifs and have no issues with it.
    – terdon
    Jun 29, 2014 at 15:27
  • I frequently experience really badly severely deadly painful hangs with cifs that affects anything that tries to stat the mounted directory. If a buffer in emacs happens to be visiting anything inside the mounted subtree, or if I do an ls on the parent of the mounted dir, etc, these things just hang indefinitely and can't even be interrupted, must be killed. I searched for this hang problem but didn't come across any mention of autofs. I will try it.
    – user84207
    Jun 29, 2014 at 16:34
  • Currently I'm using the workaround of writing to a file once per minute inside the mounted tree, hoping that this will keep things alive on both ends. I've just begun to try it but it looks promising.
    – user84207
    Jun 29, 2014 at 16:36
  • 1
    autofs will mount an export only when it is accessed and automatically unmount it after a time of inactivity. The Ubuntu docs on that are not bad.
    – terdon
    Jun 29, 2014 at 16:36

3 Answers 3

1

First, the command that you are using:

$ sudo mount -t nfs 192.168.1.76:myshare ~/mount3/

would be better as

$ sudo mount -t nfs //192.168.1.76/myshare  ~/mount3/ 

And do not forget when using ~/ to say whatever it is mounted on your root dir if using sudo it will consider you as "root" and not any user remember this! And another thing you should check are the permissions. Which users have access and what is the filesystem: NFS, NTFS, FAT16/32 ...?

1
  • 1
    I waasn't the one to downvote you but it's not true that the ~ resolves to root's home under sudo -- at least not under the pretty standard bash shell I'm using. Also, I tried your form for the mount command, and it just doesn't work.
    – user84207
    Jun 29, 2014 at 16:39
0

Here is the workaround I've been using. I have not experienced any hangs so far, after mounting the cifs share for several hours. The idea is simply to periodically write to a file on the mounted subtree. This seems to maintain things alive on both ends.

#!/bin/sh -x

mountpoint="/home/user/mount3/mount"
if mount|grep ${mountpoint}; then
    echo lazy umounting
    sudo umount ${mountpoint} -l
fi

sudo pgkill.py -fq mount_cifs.sh 
rm ${mountpoint}/keepalive


echo mounting
sudo mount -t cifs -o username=$2,password=$3,dir_mode=0777,file_mode=0777 $1 ${mountpoint}

if test $? -eq 0;then
    echo mounted
else
    echo unable to mount
    exit
fi    
{ while true; do echo dummy > ${mountpoint}/keepalive; sleep 30; done }&
-1

You could try the mountSMB or mountNFS scripts from here It should handle most of what you are trying to achieve

It will scan subnets and maintain a list of servers not available on your local subnet or through nmblookup

https://github.com/huwpowell

1
  • Show and example, do not just link to a github page.
    – number9
    Oct 12, 2022 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .