AFP and NFS shares for one dataset?

Status
Not open for further replies.

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I know it is not recommended, but what are the problems with creating two shares, one AFP and one NFS, for the same dataset? I have a Media dataset that has to be accessed by two machines. The Mac mini is the HTPC, but the software (XBMC/Kodi) doesn't support AFP correctly and NFS is the best way to go. I also need to work in there on my laptop, and AFP would be greatly preferable because of the many advantages it has (for a Mac).

If it isn't a terrible idea, which way should I set the dataset, for Unix or Mac sharing (I guess this is for ACLs)?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
This is mentioned in the manual, is it not?

File locking. NFS does its file locking and AFP does its file locking. The problem is "what happens if both protocols lock the same file at the same time?" and the answer is "expect file corruption". In short, if you want to go this route you can, but make one of them read-only. In your case you should be able to let the XBMC be "read-only" by checking the NFS box for read-only.

Do not be fooled and assume you won't write to the NFS share on purpose so it will be fine. Background tasks can touch (and corrupt) files behind your back. We've seen people have major problems because some OSes (Windows especially) will happily open and close documents to create thumbnails and such, and that can end very badly. "Go read-only on the server-side or go home" is my motto.

Keep in mind that even if you do this there can be other problems. For example, if you add files to a directory from AFP, the NFS share may or may not show them immediately (and may not for up to 30 minutes) because you were doing things "behind NFS' back". Sounds like you don't have much choice, and it sounds like it wouldn't be the end of the world if your library wasn't second-for-second up-to-date.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Thanks, that's a great idea. Yes, it is in the manual, briefly. There are a couple of examples of bad consequences, but neither includes the combination of AFP and NFS, so thought I'd ask.

The only problem with making the NFS access for the Mac mini read-only, is that I currently use that computer to prepare new media, and would be sending it to the server from there. But maybe I can eventually learn enough about jails and such to learn to do it there.

If I could ask a related question, I understand there is no password authentication for NFS, so I got access by giving full privileges to "other". I tried to limit this by entering the static IP addresses of the computers I wanted to have access (like 192.168.0.100/24) in the NFS sharing field "Authorized IP addresses or hosts", but ironically that PREVENTS access by those computers. What am I missing about how that works?

Edit - Wait - this just occurred to me in the shower. Can I set XBMC to use NFS (read only) on the Mac mini, but use AFP on the same computer to transfer files to the FreeNAS server? That would be perfect.
 
Last edited:

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
If I could ask a related question, I understand there is no password authentication for NFS, so I got access by giving full privileges to "other". I tried to limit this by entering the static IP addresses of the computers I wanted to have access (like 192.168.0.100/24) in the NFS sharing field "Authorized IP addresses or hosts", but ironically that PREVENTS access by those computers. What am I missing about how that works?

I'm betting you're putting info in for the deny access block. ;)

Edit - Wait - this just occurred to me in the shower. Can I set XBMC to use NFS (read only) on the Mac mini, but use AFP on the same computer to transfer files to the FreeNAS server? That would be perfect.

That's what I was talking about. Use NFS in read-only and AFP for actual writing and editing of files. ;)
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I'm betting you're putting info in for the deny access block. ;)

Nope - in an NFS share I only see Authorized Networks and Authorized IP Addresses or Hosts - no Deny Access But that's what it's acting like. And I triple-checked the IP address. Anyway, it's not a deal breaker.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Can you post a screenshot of the NFS settings you used?
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Can you post a screenshot of the NFS settings you used?
Here's the NFS share settings, the dataset settings, and the dataset permissions. Thanks for taking a look
NFSshare.png DatasetSettings.png DatasetPermissions.png
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You goofed it bro. Read the little tips for the blocks.

Authorized networks: Networks that are authorized to access the NFS share. Specify network numbers of the form 1.2.3.4/xx where xx is the number of bits of netmask.

Authorized IP addresses or hosts: IP addresses or hostsnames that are authorized to access the NFS share.

NOTE: You entered a non-hostname or IP address in the block.

I bet if you fix it you'll see it work properly. ;)
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
OK, that works :oops: Guess I assumed it needed the subnet mask like the authorized networks. Thanks!
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Hmm, one thing leads to another. In the dataset permissions, if I turn off privileges to "Other", the NFS client can't see it. If I turn them on, anyyone can see it in AFP. Is there a way to make it available for reading in NFS, but not in AFP (except to owner and group)?

Edit: I did it by entering myself and my group into the AFP share's 'Allow List'. Then I can leave permissions on for Other. Seems like a bit of a workaround, but this is an unusual setup I guess, and it works.
 
Last edited:
Status
Not open for further replies.
Top