Hopefully this is an easy question!

Background: I am currently using Ubuntu 12.04 as a home media server running MythTV and using XBMC as frontends on both Windows and Ubuntu. My media is shared via SMB and NFS, but I use NFS primarily for the XBMC frontends because the lower overhead translates into significantly better performance.

What I Want: What I would like to do is to create two NFS shares to my media files. One share I would like to be read/write, and the other share I would like to be read only. This way, I can set up a frontend for my roommate, for example, where he can access the files for viewing, but not screw anything up.

Since I can't create two identical NFS shares, one read/write and one read-only, I tried to create two mounts to differentiate them.

In /etc/fstab, I have the following device mounted:

/dev/stb1 /mnt/Media ext4 defaults 0 0

And in /etc/exports, I have the following NFS share:

/mnt/Media *(rw,async,all_squash,insecure,anonuid=1001,anongid=122,no_subtree_check)

The above works fine for read/write access. My intention was to create a second, read-only mount, and then export it via NFS as /mnt/Media_ReadOnly. So I've tried to create the second mount as follows:

/dev/stb1 /mnt/Media_ReadOnly ext4 ro,auto,user,noexec 0 0

but I get an error:

mount: according to mtab, /dev/sdb1 is mounted on /mnt/Media

So I guess I can't mount the same device twice?

How can I export the same path via NFS in a read-only format?


You cannot have two identical targets in a mount, full stop. Neither in NFS nor in the system.

But what you can do is to create a dummy directory structure, for example /export/rw and /export/rw/ro. Your data is in the latter; the former only contains the directory ro. Then you export /export/rw over NFS as read/write, and /export/rw/ro over NFS with read only permissions. I did not test it, but it should work. However, I'm not sure it is such a good idea.

Alternatively, consider tuning Samba performance -- actually, this would be my first choice. It should actually be faster than NFS (or at least not that much slower), at least according to documentation (and my anecdotal evidence; but then, I'm not reliable, since after years administrating an NFS-based solution I really hate this protocol). Read more here.

| improve this answer | |
  • I see. And then NFS remembers the mount point, even though the users end up at the same target directory. Gotcha. Thanks! – tfjield Jun 26 '13 at 21:00
  • Hmm... I'll look into the Samba performance more. I found with XBMC that starting to watch a movie from my server would result in a pause of around 10 seconds before the movie started. When playing from the NFS share it was practically instantaneous. It's possible that there was "something else" going on here, because it really surprises me that the two protocols would be THAT significantly different, even though other XBMC users have reported similar results. – tfjield Jun 26 '13 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.