---
name: "copyfilerange"
section: "1"
platform: "linux"
package: "util-linux"
version: "2.42.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/copyfilerange"
---

# copyfilerange(1)

copy range(s) from source to destination file

## NAME

copyfilerange - copy range(s) from source to destination file

## SYNOPSIS

**copyfilerange** \[options\] *source* *destination* *range*...

## DESCRIPTION

The **copyfilerange** command copies byte ranges from source to destination file. It is a wrapper around the [**copy\_file\_range**(2)](/copy_file_range/2.md) system call.

The command can be used to create files with unallocated gaps (sparse files) and/or with shared blocks between multiple files (reflinks).

Each *range* is of the form *source\_offset***:***destination\_offset***:***length*, with all values in bytes. If *length* is 0, then as much data as is available is copied. Multiple ranges may be supplied.

When one or both of the offsets are omitted, the operation uses the last-used file location, starting with 0.

## OPTIONS

- **-r**, **--ranges** *file*

  Read range(s) separated by newlines from this *file*.

- **-v**, **--verbose**

  Verbose output of the copied ranges.

- **-h**, **--help**

  Display help text and exit.

- **-V**, **--version**

  Display version and exit.

## EXIT STATUS

**0**

success

**1**

unspecified failure

## NOTES

The [**copy\_file\_range**(2)](/copy_file_range/2.md) system call has some serious caveats: the source and destination files must use the same filesystem type, and some virtual filesystems (like procfs) won’t work. [**copy\_file\_range**(2)](/copy_file_range/2.md) will use reflinks when the filesystem supports this. To use reflinks, the file range most often needs to align with the filesystem block size on both the source and destination file.

## AUTHORS

*Dick Marinus* \<dick@mrns.nl\>

## EXAMPLES

```
copyfilerange original-file reflink ::
copyfilerange original-file first-block ::4096
copyfilerange original-file even-blocks -r <(seq 0 8192 40960|awk '{print $1"::4096"}')
copyfilerange original-file sparse-file 0:1M:1
copyfilerange original-file split-first-mb ::1M
copyfilerange original-file split-remainder 1M::
copyfilerange split-first-mb join ::
copyfilerange split-remainder join :1M:
```

## SEE ALSO

[**copy\_file\_range**(2)](/copy_file_range/2.md)

## REPORTING BUGS

For bug reports, use the *issue tracker* \<https://github.com/util-linux/util-linux/issues\>.

## AVAILABILITY

The **copyfilerange** command is part of the util-linux package which can be downloaded from *Linux Kernel Archive* \<https://www.kernel.org/pub/linux/utils/util-linux/\>.
