Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large source code repository on a Linux NFS mount and I'd like to create a shadow copy of that repository such that only files that I write in this shadow repository are modified in my shadow repository. All other files remain symlinks or hardlinks to the master, original repository.

Can this be done with hardlinks on NFS?

I can envision a script where, much like in a version control system, I check out the files that I want to modify from the original, which causes the script to sever the link between master and shadow repositories, creating a copy of the master repository's file that I can then modify. However, I'm sure someone else has created a utility for this and I'm just not aware of the obscure Linux incantations needed to conjure up my solution.

share|improve this question
Don't know if you're still doing this, but these days I'd recommend using btrfs. It features copy-on-write cloning of directories which does exactly what you want here, without the hassle of keeping track of symlinks (and without any 3rd-party application being aware of the fact that these clones are "anything less" than the original files). Also with the added benefit that only differing blocks are stored when cloned files are changed. Other FSes (such as ZFS) also offer copy-on-write cloning, but not from any arbitrary directories or files. Btrfs is pretty cool that way :) – DanielSmedegaardBuus Aug 24 '13 at 15:02
up vote 3 down vote accepted

The X11 window system included a set of utilities that included lndir (, which created a shadow a directory. It created a copy of the original directory such that:

  1. each directory in the copy was a real directory
  2. each regular file in the copy was a symbolic link to the original

When you want to modify a file, you have to:

  1. delete its symlink in the copy
  2. copy the original file to the directory tree copy
  3. and modify it

maybe more manual than what you want, but might be easier than setting up a new filesystem. In Ubuntu 12.04, this is part of the xutils-dev package.

share|improve this answer

A UnionFS-based setup could work for you. UnionFS lets you merge the NFS read-only with a writable, dynamically growing, loop device powered filesystem.

share|improve this answer
I wonder why isn't this answer an accepted one? It's the most complete I believe. – Vladislav Rastrusny Oct 22 '14 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .