1

I remember that years ago I read about how there was a new syscall in Linux for instantaneous copying of files (cloning) but now I cannot find it. Does it really exist?

The closest thing I found was: https://man7.org/linux/man-pages/man2/copy_file_range.2.html

ArekBulski
  • 4,520
  • 4
  • 39
  • 61
  • `sendfile(2)` is probably the closest one to what you describe. Unless you are referring to the new (yet to be merged) [`readfile`](https://lwn.net/Articles/825324/), but that doesn't really have much to do with your description. – Marco Bonelli Dec 16 '21 at 16:20
  • Oh both syscalls are also of interest to me. Thanks! – ArekBulski Dec 16 '21 at 16:33
  • Some non-Linux Unix OS have `clonefileat`. Linux does have an ioctl to perform a CoW clone on filesystems that support it: https://man7.org/linux/man-pages/man2/ioctl_ficlonerange.2.html – dyp Dec 16 '21 at 17:33
  • Are you thinking of LVM snapshot? That instantly (almost) creates two copies of a whole filesystem – stark Dec 16 '21 at 20:44
  • I believe the `ioctl` syscall is what I was looking for. – ArekBulski Dec 17 '21 at 02:54
  • When is sendfile() better than copy_file_range() or visa versa? Re https://stackoverflow.com/questions/72081715/what-is-the-most-efficient-way-to-copy-many-files-programmatically – Bruce Adams May 02 '22 at 10:02

0 Answers0