17

btrfs supports reflinks, XFS supports reflinks (since 2017 I think?).

Are there any other filesystems that support it?

truncate -s 1G test.file;
cp --reflink=always test.file ref.test.file;
Matthias Braun
  • 7,797
  • 7
  • 45
  • 54
hanshenrik
  • 585
  • 4
  • 20
  • 1
    Related: [**Does any file system implement Copy on Write Mechanism for CP**](https://unix.stackexchange.com/questions/393305/does-any-file-system-implement-copy-on-write-mechanism-for-cp). – Andrew Henle Jan 27 '21 at 10:47
  • BTW, reflinking a sparse file isn't much of a test. `truncate` doesn't write or even pre-allocate the file, it *just* sets the length, so you have a purely sparse file with a non-zero length but no data extents. – Peter Cordes Mar 14 '23 at 17:55
  • 2
    https://www.ctrl.blog/entry/file-cloning.html has a table of support by OS and FS, although I'm not sure if the blog author intends to keep that up to date with future development. In Linux, BTRFS, XFS are the two well-known FSes with support. Also Bcachefs and OCFS2. But still not in EXT4 or OpenZFS as of Jan 2023. – Peter Cordes Mar 14 '23 at 18:03
  • @PeterCordes wow OpenZFS doesn't support reflinks? That's a surprise! – hanshenrik Mar 14 '23 at 19:19
  • 1
    Worth pointing out that OpenZFS recently merged support for reflinks, at least on Linux: https://github.com/openzfs/zfs/commit/48d0e9465de9571a5268f65b7446c693410e0220. The feature isn't yet part of a release but should be soon-ish. – CAFxX Aug 05 '23 at 00:00

1 Answers1

19

Support for reflinks is indicated using the remap_file_range operation, which is currently (5.11) supported by Btrfs, CIFS, NFS 4.2, OCFS2, overlayfs, and XFS.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • And NFS can do this irrespective of what the actual file system on the shared drive is? – terdon Jan 27 '21 at 10:51
  • 2
    @terdon any NFS 4.2 server [may support clones](https://tools.ietf.org/html/rfc7862#page-6), which is what reflink leads to — but the main purpose there is to reduce network traffic. An NFS server can support clones, and thus reflinks in appearance on the client side, regardless of what the underlying storage can do. – Stephen Kitt Jan 27 '21 at 10:57
  • 1
    Worth adding, an out-of-tree *(hopefully temporarily)* filesystem BCacheFS [supports reflinks capability as well](https://www.reddit.com/r/linux/comments/a25575/bcachefs_status_update_fast_mounts_reflink/). – Hi-Angel Jul 27 '21 at 10:08