You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
![]() |
2 years ago | |
---|---|---|
LICENSES | 3 years ago | |
ext/clonefile | 3 years ago | |
lib | 2 years ago | |
.gitignore | 3 years ago | |
BUILDING.md | 3 years ago | |
README.md | 3 years ago | |
Rakefile | 3 years ago | |
clonefile.gemspec | 2 years ago |
README.md
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)