NFS and CIFS shares show different content

Status
Not open for further replies.

gizimoto

Cadet
Joined
Nov 30, 2012
Messages
9
Hi All

Help I think I am going mad!

I have setup FreeNAS with a CIFS share for Windows /mnt/storage/media called "media", and a NFS share for Ubuntu same dataset also called "media".

I have each machine connecting and reading/writing files - except one problem - seems like I have two different instances of the dataset.

If I create files from NFS they do no appear in the CIFS share, and vice versa - I checked the permissions as a first test but the files that display appear to have the same permissions as those that don't (same owner and group).

Thanks
Mark
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You are somewhat correct. It's not recommended that you mix NFS and CIFS at the same time for the same files. Each one is unaware of the other and bad things can happen. For instance, if you open a document and edit it on CIFS and NFS at the same time and then save it from CIFS and then from NFS the NFS share will just overwrite the CIFS share without telling you that someone else has the file open already. It's one of the things you just don't do.

In your case you are seeing that new files created from one don't immediately appear on the other. This could backfire if you copy file "Newdoc.doc" to your NFS share then try copying another file with the same name to the same place from CIFS. Normally you'd WANT to be asked if you want to overwrite the currently existing file. In your case it may not prompt you at all and just overwrite the file because it doesn't know its there.

So yeah, setup shares for NFS and CIFS separately and don't try to mix them except in read-only settings and accept the fact that files will not immediately appear on the opposite sharing service.
 

gizimoto

Cadet
Joined
Nov 30, 2012
Messages
9
Thanks noobsauce80... thats what I figured regarding not to mix, what sort of time is 'immediate'? hours later the shares have not sync'd which makes me think I have a bigger issue.

For example from the FreeNAS shell (option 9), navigating to the dataset I get something like:
Code:
[root@freenas] /mnt/storage/media/tv/atvshow> ls -la
total 1476
drwxrwxr-x   3 root  media      10 Jan  5 18:20 ./
drwxrwxr-x  39 root  media      39 Nov 26 21:53 ../
-rwxrwxr-x   1 root  media   33280 Jan  5 21:46 Thumbs.db*
-rwxrwxr-x   1 root  media  330953 Jul 31 23:13 backdrop.jpg*
-rwxrwxr-x   1 root  media  199071 Jul 31 23:14 cover.jpg*
-rwxrwxr-x   1 root  media  330953 Jul 31 23:14 fanart.jpg*
-rwxrwxr-x   1 root  media  199071 Jul 31 23:13 folder.jpg*
-rwxrwxr-x   1 root  media    1167 Jul 31 23:14 series.xml*
drwxrwxr-x   2 root  media       2 Jan  5 18:19 test/
-rwxrwxr-x   1 root  media    2413 Jul 31 23:14 tvshow.nfo*


Which mirrors what I get from the CIFS share from a Windows7 PC - the "test" directory was created from Windows.

However, from my Ubuntu servers (two different machines) which mounts the NFS share as follows

Code:
mark@ubuntuserver> mount -l
.. snip ..
192.168.1.205:/mnt/storage/media on /mnt/media type nfs (rw,addr=192.168.1.205)


I get something similar but with more content (created by the Ubuntu machine) and no temp directory

Code:
mark@ubuntuserver:/mnt/media/tv/atvshow$ ls -la
total 360660
drwx------  3 root root        17 Jan  5 15:03 .
drwxr-xr-x 40 root root        41 Jan  5 14:25 ..
-rw-rw----  1 root root 183496704 Jan  5 15:02 atvshow - S01E04 - atitle.avi
-rw-rw----  1 root root      1996 Jan  5 15:02 atvshow - S01E04 - atitle.nfo
-rw-rw----  1 root root     12728 Jan  5 15:02 atvshow - S01E04 - atitle.nfo-orig
-rw-rw----  1 root root       559 Jan  5 15:02 atvshow - S01E04 - atitle.sfv
-rw-rw----  1 root root 183496704 Jan  5 15:03 atvshow - S01E05 - anothertitle.avi
-rw-rw----  1 root root      1999 Jan  5 15:03 atvshow - S01E05 - anothertitle.nfo
-rw-rw----  1 root root     12728 Jan  5 15:03 atvshow - S01E05 - anothertitle.nfo-orig
-rw-rw----  1 root root       559 Jan  5 15:03 atvshow - S01E05 - anothertitle.sfv
-rw-rw----  1 root root    330953 Jan  5 12:46 backdrop.jpg
-rw-rw----  1 root root    199071 Jan  5 12:46 cover.jpg
-rw-rw----  1 root root    330953 Jan  5 12:46 fanart.jpg
-rw-rw----  1 root root    199071 Jan  5 12:46 folder.jpg
drwxrw----  2 root root         4 Jan  5 15:03 metadata
-rw-rw----  1 root root      1167 Jan  5 12:46 series.xml
-rw-rw----  1 root root      2413 Jan  5 12:46 tvshow.nfo


Based on the dates and files I am confident the NFS share is completly different from the CIFS share - which means I messed up configuration somewhere. I have checked my share configs and confirmed they both point to /mnt/storage/media.

The question now is even if I want to drop to NFS shares and use CIFS only, where are these files so I can remove/delete them from the FreeNAS /mnt/storage/ as I am unable to locate them.
 

gizimoto

Cadet
Joined
Nov 30, 2012
Messages
9
Ok, I have found how to recreate my problem - I think this may be a bug.

Create a ZFS data set /mnt/storage/nfs, create a NFS and CIFS share for this - this works as expected - new files/edits show in each share method as normal (Windows & Ubuntu)
Create a sub ZFS data set /mnt/storage/nfs/nfschild

Now accessing the 'nfschild' folder via NFS and created a file 'from_nfs.txt', this does not appear in CIFS share, in CIFS share create a file 'from_cifs.txt' and this does not appear in NFS share.

So for all intents the sub ZFS data set is two independant instances.

Oddly enough I am unable to locate the NFS data directly on the FreeNAS shell. I assume the NFS instance treats 'nfschild' as a directory not as a zfs dataset hence it is invisible - does this sound valid?

I am running FreeNAS-8.3.0-RELEASE-p1-x64 (r12825) under ESXi.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
It doesn't sound valid, but I don't use datasets. I have a theoretical understanding of them and I believe I could implement them if I desired but haven't had a need...yet.

It could be that Samba(or the NFS service) get a message when its subdirectory is updated but not for subdatasets or it could be that one doesn't know about the other as each thinks its the sole file sharing service.

What happens if you do this with only 1 service running? I'd try both NFS and Samba individually and see if you can reproduce the error with each. Also, it could be that subdatasets won't be picked up unless the sharing service is stopped and restarted. Or perhaps a reboot is required.

The thing to keep in mind is that datasets aren't something you should be creating lots of regularly, so I want to think this is simply an issue because you(and I) aren't aware that the service must be restarted or the system rebooted to properly use a dataset. To you and me we think "I just put a dataset there so I should have immediate access to it". It may be a permissions issue too. /shrug
 
Status
Not open for further replies.
Top