Is there a way to create a copy-on-write copy of a directory?

Posted by BCS on Server Fault See other posts from Server Fault or by BCS
Published on 2010-04-07T02:57:57Z Indexed on 2012/09/02 21:39 UTC
Read the original article Hit count: 183

Filed under:
|

I'm thinking of a situation where I would have something that creates a copy of a directory, tweaks a few files, and then does some processing on the result. This wold be done fairly often, maybe a few dozen times a day. (The exact use case is testing patch submissions; dupe the code, patch it, build/test/report/etc.)

What I'm looking for could be done by creating a new directory structure and populating it with hard links from the origonal. However this only works if all the tools you use delete and recreate files rather than edit them in place.

Is there a way to have the file system do copy-on-write for a file?


Note: I'm aware that many FSs use COW at a block level (all updates are done via writes to new blocks) but this is not what I want.

© Server Fault or respective owner

Related posts about filesystems

Related posts about hardlink