2
1
Fork
You've already forked ruby-clonefile
0
A Ruby gem that implements reflink copy (copy-on-write) for supported file systems on Linux.
  • Ruby 72.2%
  • C 27.8%
2020年12月18日 20:29:51 +01:00
ext/clonefile Whitespace 2020年09月26日 00:26:31 +02:00
lib Rescue more errors from man 2 ioctl_ficlone. 2020年12月18日 20:29:51 +01:00
LICENSES Update LICENSE headers to REUSE 3.0 2020年09月01日 13:16:13 +02:00
.gitignore Rename to clonefile. Add macOS/APFS support. 2020年09月10日 13:01:43 +02:00
BUILDING.md Rename to clonefile. Add macOS/APFS support. 2020年09月10日 13:01:43 +02:00
clonefile.gemspec Set version to 0.5.3. 2020年12月18日 19:06:08 +01:00
Rakefile Resolve RuboCop offenses. 2020年09月10日 13:13:36 +02:00
README.md Add info link on file cloning 2020年09月26日 00:29:07 +02:00

Clonefile is a Ruby gem for cloning files on supported copy-on-write (COW) file systems. Learn more about file cloning.

On Linux 5.7 and later, the gem performers the same operation as cp --reflink (using FICLONE). As of kernel 5.7, only Btrfs, OCFS2, and XFS supports ficlone. This gem only supports creating reflinks to whole files and not ranges within a file. However, it exports both the IOCTL ficlonerange and fideduprange constants.

On macOS 10.12.1, the gem performs the same operation as cp -c (using clonefile). As of macOS 11, only APFS supports clonefile.

Get started

You can find build and install instructions in BUILDING.md.

You probably want to install it via RubyGems:

gem install clonefile

Usage

require 'clonefile'
# Clone the file or fallback to make a regular copy.
Clonefile.auto(source_path, destination_path)
# Clone the file or raise an exception.
Clonefile.always(source_path, destination_path)