Btrfs support Copy-On-Write. I tried to use that feature to clone a directory:
cp -R --reflink=always foo_directory foo_directory.mirror
I expected the command to finish almost instantly (like a btrfs subvolume snapshot
), but the cp
command seems to perform a slow, standard copy.
According to the man page, I would expected --reflink=always
to enforce Copy-On-Write:
When
--reflink[=always]
is specified, perform a lightweight copy, where the data blocks are copied only when modified. If this is not possible the copy fails, or if--reflink=auto
is specified, fall back to a standard copy.
Questions:
- Do you know why
--reflink=always
doesn't work? - What options (or other commands) should I use instead?