Home

Awesome

xcp: An extended cp

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement, but as a companion utility with some more user-friendly feedback and some optimisations that make sense under certain tasks (see below).

Crates.io Github Actions CircleCI Packaging status

Warning: xcp is currently beta-level software and almost certainly contains bugs and unexpected or inconsistent behaviour. It probably shouldn't be used for anything critical yet.

Please note that there are some known issues with copying files from virtual filesystems (e.g. /proc, /sys). See this LWN article for an overview of some of the complexities of dealing with kernel-generated files. This is a common problem with file utilities which rely on random access; for example rsync has the same issue.

Installation

Cargo

xcp can be installed directly from crates.io with:

cargo install xcp

Arch Linux

xcp is available on the Arch Linux User Repository. If you use an AUR helper, you can execute a command such as this:

yay -S xcp

NetBSD

xcp is available on NetBSD from the official repositories. To install it, simply run:

pkgin install xcp

Features and Anti-Features

Features

(Possible) future features

Differences with cp

Performance

Benchmarks are mostly meaningless, but the following are results from a laptop with an NVMe disk and in single-user mode. The target copy directory is a git checkout of the Firefox codebase, having been recently gc'd (i.e. a single 4.1GB pack file). fstrim -va and echo 3 | sudo tee /proc/sys/vm/drop_caches are run before each test run to minimise SSD allocation performance interference.

Note: xcp is optimised for 'modern' systems with lots of RAM and solid-state disks. In particular it is likely to perform worse on spinning disks unless they are in highly parallel arrays.

Local copy

NFS copy

xcp uses copy_file_range, which is filesystem aware. On NFSv4 this will result in the copy occurring server-side rather than transferring across the network. For large files this can be a significant win: