Sample Header Ad - 728x90

Copy on write for directories?

3 votes
1 answer
1197 views
Some file-systems notably XFS and btrfs support Copy on Write at block level for files. This is done by reflinking where the underlying blocks are shared between files until they are modified. Since a directory is essentially [an associative array mapping file names to inodes](https://unix.stackexchange.com/questions/18605/how-are-directories-implemented-in-unix-filesystems) it should be straight forward to do something similar for directories. Have any filesystems been developed which can support this on Linux (or any other Unix-like system)? Presumably it would need kernel support just like use reflinking does. That is a call like copy_file_range () which works with directories. Is anyone actively working on this? Is it simply that no-one has wanted to do it yet or is there any reason why this is a bad idea or unecessary? Are there any particular technical obstacles that need to be overcome? See also https://serverfault.com/questions/129969/is-there-a-way-to-create-a-copy-on-write-copy-of-a-directory which does not really answer this question.
Asked by Bruce Adams (682 rep)
May 14, 2022, 08:15 PM
Last activity: May 16, 2022, 09:06 AM