Closed ChrisJefferson closed 2 years ago
Thanks, this is a great idea!
See also FICLONE ioctl which is supported by a few CoW filesystems (Btrfs, XFS, and also NFS and SMB for server-side clones) Exists since Linux 4.5.
There is also copy_file_range syscall.
See some discussion on relative merits of these here: https://stackoverflow.com/questions/65505765/difference-of-ficlone-vs-ficlonerange-vs-copy-file-range-for-copy-on-write-supp
By the way, cp
implements this functionality under --reflink
flag, so I suggest command name to be reflink
.
See #74, I'd appreciate some design feedback.
Btrfs supports in place dedup ( https://btrfs.wiki.kernel.org/index.php/Deduplication ), via a syscall. This is completely safe, as checks if the files are identical before deduping.
This would be very Linux specific low level code.