# Mounting cifs share in fstab, FreeBSD 7.0



## jmpetre (Sep 4, 2009)

This is my line in fstab

```
//192.168.249.1/storage /mnt/storage cifs rw,username=***,password=*** 0 0
```

When I do mount -a, I get this

```
mount: /server/storage : Operation not supported by device
```

I can mount the share fine from 2 linux boxes with the same fstab entry, and many windows devices as well, so what am I doing wrong?

Any help is appreciated.

Jesse


----------



## vivek (Sep 4, 2009)

Command line syntax is as follows:

```
mount_smbfs -I 1.2.3.4 //username@ntserver/sharename /mnt/storage
```
To avoid password prompt you need to create ~/.nsmbrc file:

```
[192.168.249.1:USERNAME]
password=YOURPASSWORD
```
Update /etc/fstab as follows:

```
//username@192.168.249.1/stronage  /mnt/storage     smbfs  rw,noauto 0   0
```

http://www.cyberciti.biz/faq/mounting-a-nas-with-freebsd-mount_smbfs/


----------



## jmpetre (Sep 4, 2009)

THANK YOU!!!

I guess this is another difference between linux and bsd.  I tried searching for FreeBSD and CIFS, but had trouble turning up anything useful.  I did have to change the fstab entry to use the hostname.  It would not work with the IP, but it worked great.

Jesse


----------



## user0 (Apr 24, 2016)

I too am trying to mount a smb share at boot time, but nothing at all seems to work:

Created `/root/.nmbrc` and put the same file under `/home/user0` too.


```
[10.10.10.2:user0]
password=12345

[FSERV:user0]
password=12345
```

Added this to `fstab`:

```
//user0@FSERV/DRIVED    /home/leo/DriveD    smbfs        rw,noauto,-N,-I10.10.10.2    0    0
```
`sudo mount -a`does nothing at all.
Also tried this:

```
//user0@10.10.10.2/DRIVED    /home/leo/DriveD    smbfs        rw,noauto,-N,-I10.10.10.2    0    0
```
Same result, no mounting.
These commands throws the error but explicit user and password entered from console works:

```
[leo@leo00 ~]$ sudo mount_smbfs -I 10.10.10.2 -N //FSERV/DRIVED DriveD
mount_smbfs: unable to open connection: syserr = Authentication error
[leo@leo00 ~]$ sudo mount_smbfs -I 10.10.10.2 -U user0 -W WG //FSERV/DRIVED DriveD
Password:
[leo@leo00 ~]$
```
At the same time Dolphin can brows to that share no problem, it asks for a user id and password and voila, shows the share.
What am I doing wrong?


----------



## T-Aoki (Apr 27, 2016)

Through this thread, fstab entry for smbfs seems missingly configured.
Try "late" instead of "noauto".
The "noauto" option means "Don't mount this automatically",
while "late" means "Mount this after configured daemons are running".

Whithout whichever option, system would try to mount smbfs share
BEFORE network is up and running, and of course misses, resulting to
go single user mode.

For me, I prefer "noauto", as my working computer is notebook one only.
I often use it outside of internal network, and if configured with "late", it
should go single user mode at the time.

If your work scenario is like this, and still want automounting when connected
to internal network, consider using some automount programs.
(I don't use any for network shares, but using vermaden's sysutils/automount
for removable medias.)


----------



## user0 (Apr 28, 2016)

noauto is a non-issue for me. The issue is that while the fstab entry seems to be perfectly fine, `mount -a` or `mount ~/DriveD`do not work. Getting all kinds of seemingly random errors:


```
$ sudo mount /home/leo/DriveD
mount_smbfs: unable to open connection: syserr = Cannot allocate memory
[/usr/home/leo]$ sudo mount DriveD
mount: DriveD: unknown special file or file system
```

Tried adding space between -I and 10.10.10.2 but that does not work either:

```
$ sudo mount /home/leo/DriveD
mount_smbfs: can't get server address `//user0@FSERV/DRIVED':
Host name lookup failure
mount_smbfs: can't get server address: syserr = Network is down
```
Something so trivial should just work, just like this command does:

`sudo mount_smbfs -I 10.10.10.2 -U user0 -W WG -d 755 -f 644 //FSERV/DRIVED DriveD`


----------



## tobik@ (Apr 28, 2016)

user0 said:


> Something so trivial should just work, just like this command does:
> 
> sudo mount_smbfs -I 10.10.10.2 -U user0 -W WG -d 755 -f 644 //FSERV/DRIVED DriveD


That command has different options than what you have in /etc/fstab. Can you try this?

```
//FSERV/DRIVED    /home/leo/DriveD    smbfs        rw,noauto,-N,-I=10.10.10.2,-U=user0,-W=WG,-d=755,-f=644    0    0
```
`mount -a` will never mount filesystems that are marked with noauto (see mount(8)).


----------



## user0 (Apr 28, 2016)

Yeah, yeah, been there done that before getting desperate and trying all kinds of things to make the damn thing work!
I just did not want to embarrass anyone by reporting that with the format you provided the OS goes into panic from the command

`sudo mount /home/leo/DriveD`

and if I used a short-hand than it threw another error:

```
[leo@leo00 ~]$ mount ./DriveD/   
mount: ./DriveD: unknown special file or file system
```


----------

