1

I have two CentOS boxes, essentially a QA and a production box, and I want to use nfs to mirror over the entire directory structure of my prod box to QA, however, I want to exclude a certain nested directory, and instead have that be a directory located local to the QA box. For example:

**Prod box**
/
  local/
    libs/
    repos/
  bin/
  etc/

**QA** (<> means nfs'ed from prod)
</
  local/
    libs/>
    repos/
  <bin/
  etc/>

So basically, how can I have repos be a directory local to the QA box, while having the rest of the filestructure as nfs?

  • 1
    It appears you would like the root `/` filesystem and `/etc/` directory to be "nfs'ed from prod" which is going to cause problems. Were you leaving out intermediate paths? Also, you open the possibility of QA activities to affect prod, which is not a good idea. You should use proper system and software management techniques; NFS isn't one. – Mark Wagner Nov 28 '11 at 19:12
  • Would there be a way of making the nfs ready only on the QA side to prevent that? or is nfs not capable of such a thing? Also, it would be a intermediary path such that I can have some local directories; this was just a (crappy) example. – user1040625 Nov 28 '11 at 19:24
  • NFS (like any other filesystem) can be mounted read-only, but this may create other problems (when `/tmp` and `/var/tmp` aren't writable, for instance) -- IMHO You're better off using a deployment system and *deploying* the production configuration to your dev environment to make sure they match up... – voretaq7 Nov 28 '11 at 19:36
  • the environment in terms of packages/os configuration is synced by a system, however, there are third party libraries and some data that I want to mirror through to QA. /tmp and /var/tmp/ will stay local. I guess my example is bad; I'm not trying to nfs my root directory. – user1040625 Nov 28 '11 at 19:41

2 Answers2

4

Look into mount --bind for the QA box. Be sure to use the appropriate flags to make sure it will behave appropriately if it should become unmounted.

thinice
  • 4,716
  • 21
  • 38
1

Though slightly different, the process mentioned here works for what you're looking to do.

Access files located on the underlying filesystem of an NFS mountpoint

ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • bear with me, because I'm just a lowly developer and not a sysadmin: so in this case would you do the nfs mount -first- on the entire filestructure, then do "mount --bind /local/repos /somelocaldir"? – user1040625 Nov 28 '11 at 19:23