CIFS and NFS together?

Status
Not open for further replies.

doglover

Dabbler
Joined
Nov 22, 2012
Messages
44
Good evening. I have read that it is bad to have a folder shared out with both NFS and CIFS at the same time.
If I am the only person using the server and know I will not be accessing them with both at the same time, is it really bad to do that?
Or is it OK in that circumstance? I have tried it and I didn't see a problem, but want to avoid data loss if possible.

Thanks,
IMF
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
That is the only "safe" use case. If you are the only one that will ever use it and you won't ever access the same file from both at the same time you are fine. But then you can ask another question.. "Why bother?"
 

doglover

Dabbler
Joined
Nov 22, 2012
Messages
44
Fair question. I have lots of different computers in the house, some of which use windows and some Linux. Some of the Linux are installed and some I run off live media. Since I am lazy and don't want to have to configure the samba for the live CDs, I thought NSF would be easier since I understood that NSF was IP address based and that my live sessions should just work assuming my server was set up properly. But the windows won't use NSF, and that is why both. Thoughts?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
You'll probably be fine.

The biggest underlying question is file locking; most operating systems provide a way for a process to lock a file. This can be propagated across the network, but may be done a bit differently by the different filesharing protocol.

If you only need read access to the content, maybe you can make the NFS read-only and then you will be guaranteed to never have an issue.
 

RvdKraats

Dabbler
Joined
Aug 8, 2012
Messages
34
I use CIFS and NFS for the same share, but kept the NFS access read-only to prevent multiple programs/users from editing the same file. Both protocols don't cooperate in terms of file locking AFAIK.
I use the NFS protocol for speedy readonly access to movies from my Boxee Box, and CIFS access from my laptop to perform actual uploads/downloads/edits.
 

dantest69

Cadet
Joined
Jun 19, 2013
Messages
8
I use CIFS and NFS for the same share, but kept the NFS access read-only to prevent multiple programs/users from editing the same file. Both protocols don't cooperate in terms of file locking AFAIK.
I use the NFS protocol for speedy readonly access to movies from my Boxee Box, and CIFS access from my laptop to perform actual uploads/downloads/edits.

That's exactly what I'm thinking of doing - read-only NFS for quick network streaming of audio/video to various streamers (i.e. WDTV or XBMC) and write access CIFS for computer access (i.e. copying, creating and editing files).

Has your setup been working for you so far?

Thanks for sharing your experience.
 

RvdKraats

Dabbler
Joined
Aug 8, 2012
Messages
34
Hey Dantest69,

I must admit i haven't been troubleshooting lately, but so far it works...sort of. One thing i can't figure out is that if I let the Boxee index all movies, it sometimes seems to 'skip' a few movies when using NFS. With CIFS, this doesn't happen. Also, some movies won't play under NFS, that also doesn't happen under CIFS. Can't put my finger on the problem; it only happens to *some* movies, I checked the access rights in the filesystem share, and they're all the same across the movie files. Maybe it's got something to do with the NFS share being read-only (although that shouldn't matter, and again: why only *some* movies?), or an incompatibility between FreeNAS' and Boxee's NFS version. So, mostly i use the CIFS share, but it still stings me why said problems occur...
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
For most things, read-only sharing via NFS and CIFS works "okay". There are alot of programs and hardware out there that has issues when it tries to write an index file(thumbs.db in the windows world comes to mind) and your image viewer is trying to make one and the directory is read only. If you have 10000 pictures in a folder it may crash, give you 10000 error windows, or work perfectly.

Personally, I avoid using read-only directories except for public permissions folders. I have a read-only share of my movies/music/tv shows and if a friend wants to watch something he can easily log in without a password. If it works for him, great. If it doesn't, I'm not going to cry about it. It works for me with VLC when I've tested it. But on my machines I use the writable share.

Making one protocol read-only and the other writable is about the only smart way to share the same data. I try to use CIFS as much as I can. I use it in Linux, Windows, and FreeBSD without issues. I haven't tried a Mac since I don't have one, but I believe CIFS is available and works fine on Apple stuff.
 

RvdKraats

Dabbler
Joined
Aug 8, 2012
Messages
34
Hi Cyberjock,

The Boxee Box keeps it's index stored locally (AFAIK), so it wouldn't need r/w access. That's why i indeed use r/w permissions via CIFS (to put the files in the directories), and r/o permissions via NFS for the same files (to play them)...like you said, to avoid incompatible filelocking issues.

But, the weird thing is, when using r/o NFS access, -most- movies play ok, and -some- won't (and also won't show up on Boxee's dashboard, once indexing is finished)...although all files have the same permissions, etc.

Maybe i'm just focussing on NFS access too much, i want to use it because of it's lower overhead, but as my Boxee is connected to the FreeNAS box via 100Mbit ethernet connection, CIFS performance is probably just fine and stutter-free, even for high-quality HD movies.

BTW, in general: simultaneous NFS and CIFS sharing of the same files works ok, if you respects the filelocking issue :)
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
The Boxee Box keeps it's index stored locally (AFAIK), so it wouldn't need r/w access. That's why i indeed use r/w permissions via CIFS (to put the files in the directories), and r/o permissions via NFS for the same files (to play them)...like you said, to avoid incompatible filelocking issues.

But, the weird thing is, when using r/o NFS access, -most- movies play ok, and -some- won't (and also won't show up on Boxee's dashboard, once indexing is finished)...although all files have the same permissions, etc.
There may be something with the way those files are read. Perhaps they haven't been indexed before with a writable folder. There's almost certainly something in common with those movies that won't. Figuring that out might not be easy. It may not be the files themselves either but simply the way they have been indexed in the past.


Maybe i'm just focussing on NFS access too much, i want to use it because of it's lower overhead, but as my Boxee is connected to the FreeNAS box via 100Mbit ethernet connection, CIFS performance is probably just fine and stutter-free, even for high-quality HD movies.

AFAIK the lower overhead you are hoping to achieve is mostly with CPU resources and not network resources. Samba(CIFS) is single threaded while NFS is multi-threaded. CIFS used to be VERY chatty, but with v2.0(released with Windows Vista) a lot of the chattiness is gone. Comparing speeds of CIFS versus NFS with my Gb LAN I have been able to be within 1MB/sec of each other, so I don't know why you'd be worried about 100Mbit/sec ethernet and saving a little overhead(if there is even any savings). I consider the protocols themselves to be roughly on par with each other and the implementation(and support on the desktop side) to be the more decisive factors. Since I can saturate 2xGb LAN ports simultaneously with my hardware with CIFS I don't know how NFS would provide any benefit at all that would make me consider going dual-protocol or even switching to NFS. If I had 10Gb/sec LAN hardware then things might be different though(but I'd have to test that before I'd actually consider making a switch).


BTW, in general: simultaneous NFS and CIFS sharing of the same files works ok, if you respects the filelocking issue :)

Don't fool yourself and think that YOU can respect the file locking issues. Windows XP(and even more so Vista, and even more than Vista with 7 and 8) does a lot(and I mean a whole lot) of stuff in the background. Opening folders that contain sound files, picture files, media files, Office documents(if Office 2007 or newer is installed) and PDFs(if Adobe Acrobat is installed) and probably alot more stuff will trigger alot of things to start happening in the background. For example, caching stuff for text searching, thumbnails, sound file information and tags, video file tags etc. all do things in the background that you sometimes don't even know are happening. While you could disable the ones you can clearly identify are happening(such as thumbnail generation) there are so many that go in that you won't notice I would never ever make the assumption that you are capable of respecting the file locking issues yourself. The consequences could be disastrous for your data too.

I can't find the link, but someone had some application that could fix certain picture corruption issues. He accidentally opened the folder on 2 machines at the same time and this app started "fixing" the pictures that had a bad date in the header of the pictures(year was 1970 or something). Instead, as the explorer addon crawled through his entire picture collection the 2 computers competed with each other and he ended up losing tons of personal pictures of which he had no backup. In fact, he had no clue what had gone on until after the damage was done and he put the puzzle pieces together.

So, for the reasons I've explained(and the example above) I do not tell people to "be careful and respect the file locking issue" as you aren't capable of controlling what your OS does behind your back and you'll become another example of why "you shouldn't do that".

There's lots of things people can do that can be completely harmless and appear to work just fine.. until it doesn't. And when it doesn't you are left with corrupted files(or no files at all). And statistically based on most forum users it seems more than 75% of the time you(the user) won't have good solid up-to-date backups and you'll be losing some of your data forever. Just a few other examples of things that may work until they don't are:

-Using ESXi with RDM.
-Using USB disks as external drives with FreeNAS.
-Using NTFS with FreeBSD for more than simply moving your data to FreeNAS.

Just don't do it if you value your data.
 
Status
Not open for further replies.
Top