Skip to content

Analyses / Filesystem engineering

Fast file clones: where the copying cost goes

Published 15 October 2026 / Updated 8 November 2026

A fast logical copy tells you when a new view became available. It does not tell you how much work later changes will require, whether a whole application was captured consistently, or whether the copy survives loss of its storage.

Three operations that are not interchangeable

A hard link gives the same file another name: writes through either name affect the same contents. It is not a private working copy. [5] Linux FICLONE instead shares storage while preserving isolation of later writes; it requires the same filesystem and is atomic relative to concurrent writes. That is a per-operation contract, not a directory-tree transaction. [2]

copy_file_range() is a third interface. It permits in-kernel copying and filesystem acceleration, including reflinks or server-side copying. Its name does not identify which mechanism ran. A successful call can return fewer bytes than requested; callers must account for progress and stop appropriately at EOF. [3]

The engineering consequence is that equal file hashes establish equal observed bytes, not independent allocation or an independent failure domain. Record the operation and its outcome separately from the recovery claim.

NVMe Copy offloads a command, not a backup guarantee

NVMe Copy addresses source ranges and a destination logical-block range, not filenames. The host supplies descriptors instead of reading the payload into host memory and writing it back. [24, section 3.3.2] The command-line interface exposes both source namespace IDs and descriptor format; these options do not establish device support. [25]

Do not equate this command with Linux FICLONE, whose contract explicitly shares file storage and isolates subsequent writes. [2] Nor assume offload guarantees a physical duplicate: NVM Command Set 1.1 permits copy-on-write fast-copy implementations. Fast-copy support is not an unconditional latency promise. [24, section 3.3.2.1]

For block-addressed descriptors, formats 0h/1h use one namespace; 2h/3h can reference other source namespaces. Capability, host enablement and format compatibility still matter. The limits MSRC, MSSRL and MCL constrain range count, each range's length and total length. [24, section 3.3.2 and Figure 114]

Failure is not rollback. The completion reports the lowest-numbered unsuccessful source-range index, not a byte count. Higher-numbered ranges may already have changed the destination. A zero result does not prove that no data changed. Atomicity remains subject to write-unit and boundary rules; treating the write portion as one Write does not make an arbitrarily large Copy transactional. [24, sections 3.3.2.2 and 3.3.2.5]

For formats 2h/3h, the Fast Copy Only (FCO) bit requests a fast method for a source range. If unavailable, the command fails with Fast Copy Not Possible. For that status, DNR=0 permits retry; DNR=1 advises against retrying that Copy command. Host Read/Write copying remains an alternative. [24, section 3.3.2.1]

Evaluation implication: record the descriptor format, advertised limits, completion status and independent destination verification. Keep host traffic, physical allocation and recovery independence as separate measurements. This is a specification comparison, not a device experiment.

Deduplication has a result for each destination

FIDEDUPERANGE compares existing ranges before sharing their storage. Unlike cloning, it does not replace different destination bytes with the source. Each destination has a status: FILE_DEDUPE_RANGE_SAME, FILE_DEDUPE_RANGE_DIFFERS or a negative error code. The comparison and sharing are atomic relative to concurrent writes. [13]

A successful ioctl is not a successful batch. The pinned VFS loop records destination errors and continues; one invalid descriptor does not undo earlier destinations. Inspect every result. This is not an all-or-nothing transaction across the destination array. [14]

A historical byte counter can overstate progress

In Linux v6.18, vfs_dedupe_file_range() allows a shorter operation but reports the capped request length after a nonnegative callback result, not that callback's returned length. The generic preparation path rounds a nonaligned length down unless the range ends at both files' EOF. Thus a successful result is not, on this path, a byte-accurate coverage certificate. [14]

Worked source-path examples with 4,096-byte blocks and zero offsets. These are calculations, not filesystem measurements.
CaseRequested bytesAfter generic roundingHistorical reported bytes
Aligned prefix98,30498,30498,304
Unequal-length prefix100,00098,304100,000
Both files end here100,000100,000100,000
Sub-block prefix1,69601,696

The unequal-length prefix example leaves 1,696 bytes outside the rounded operation. A sub-block prefix can round to zero. These examples assume distinct eligible files, valid ranges and a successful callback following the generic path; they do not model filesystem-specific restrictions. Source version matters: this is not a claim about every downstream kernel or a newly discovered defect.

Keep three quantities separate: requested length, reported progress and independently observed sharing. None is automatically reclaimed physical space. Existing shared references, metadata and later copy-on-write remain relevant. For a measurement, retain per-destination results and use filesystem-aware accounting with its scope recorded; do not label the sum of returned byte counters as space saved.

The wrapper has another failure boundary: it performs the operation before returning the result array to userspace. A failed result copy can return EFAULT after work has occurred. A failed syscall therefore is not a general rollback certificate. [15, ioctl_file_dedupe_range]

Inspect the calculation code and structured examples. They are a narrow source-reading aid, not a deduplication utility or a reproduction of the FAST benchmark below.

Ordinary cp may already try a reflink

The GNU manual reviewed here documents --reflink=auto as the default. It falls back to ordinary copying when cloning is unsupported. --reflink=always requires cloning and reports failure when unavailable; --reflink=never disables this copy-on-write mode. Do not assume another utility or older installation has the same default. [4]

GNU also warns that an I/O error in shared data blocks affects both files. Choosing --reflink=never is a copying-policy choice, not proof of a different disk, pool, account or site. Those remain separate questions.

Capacity can be needed after cloning succeeds

Copy-on-write may need new storage on a later modification. Where supported, FALLOC_FL_UNSHARE_RANGE makes shared extents private so subsequent writes will not fail for lack of filesystem space. The operation itself must succeed. [6] This does not establish end-to-end capacity in an underlying thin-provisioned pool; see allocation at different layers.

For a fleet of writable clones, our recommendation is to budget for divergence as well as initial creation. Report retained versions, workload duration and available space. A test stopped immediately after creating its clones answers a much narrower question than a service that keeps changing them.

Maintenance can undo sharing without changing file contents

Btrfs filesystem defragmentation rewrites layout and does not preserve shared extents. Combined retained allocation across copies and snapshots can therefore increase, even when their logical bytes stay unchanged. This is a Btrfs-specific maintenance contract, not a property of every filesystem's defragmenter. [7]

Transparent compression is a separate choice. Btrfs compression settings affect new writes, not a retroactive conversion of all stored data. Recompressing through defragmentation applies the selected algorithm to that operation; it does not permanently replace the policy for future writes. [8]

Constructed accounting example, not a measurement: two files initially share 1 MiB of uncompressed data allocation. Suppose rewriting one file replaces its reference with 0.5 MiB of private compressed allocation. The other file retains the original 1 MiB. Combined retained data are now 1 + 0.5 = 1.5 MiB, despite halving the rewritten copy's data allocation.

This example assumes complete unsharing of the selected data and unchanged logical contents. It excludes metadata, replication or parity, allocation rounding and temporary workspace. It predicts neither peak space nor a real compression ratio; no Btrfs experiment was run. The general accounting point is that saving bytes in a replacement does not release an original still referenced elsewhere.

The v6.16 command manual also limits what a maintenance run establishes: recursive defragmentation skips nested subvolumes, mount points and directory symlinks; its target extent size is advisory. It needs space for rewritten dirty data. A completed traversal is not evidence that every snapshot was processed or a chosen layout achieved. [9]

Evaluation implication: include maintenance in a clone's lifecycle. Record scope, retained snapshots, sharing, compression policy and free-space headroom before comparing allocation afterward. These are evaluation criteria, not instructions to run a rewrite on a nearly full production filesystem.

Shared bytes are not necessarily reclaimable bytes

Btrfs filesystem du uses FIEMAP to distinguish total, exclusive and set-shared extent accounting. Each path argument defines its own set; overlapping shared ranges are counted once within that set. Its traversal enters subvolumes but not mount points, unlike recursive defragmentation. [9]

btrfs filesystem du --raw -s -- /path/to/clone-set

Do not sum independent set-shared rows as unique storage. Two separately inspected directories can reference the same extent. Nor does a shared range prove that all its references are inside the selected directory. Deleting that directory need not release it. These are accounting consequences of the documented set scope, not a deletion-space prediction.

The pinned v6.16 implementation skips UNKNOWN, DELALLOC and DATA_INLINE extents. It does not request FIEMAP_FLAG_SYNC. During directory traversal, EACCES and ENOTTY can produce warnings and continue without a failing final status. Inspect stderr as well as the exit code: a successful command is not proof of complete coverage. [10, du_calc_file_space and du_walk_dir]

For compression, compsize v1.5 defines three different quantities: compressed disk usage, whole extents before compression, and referenced file bytes excluding holes. It counts a referenced extent whole and once, even when only part is used; that extent may also serve files outside the selection. These columns cannot be substituted for one another or for deletion savings. [11]

Which tree and which bytes did the query describe?

FIEMAP_FLAG_XATTR selects the extended-attribute tree, not the file-data tree. An empty result from that request is not evidence that the file has no allocated data. Returned extents may begin before the requested start or end after the requested range. [16]

A count-only query sizes a result buffer; it does not freeze the mapping for the next call. The two calls do not form a snapshot. Some implementations use FIEMAP_EXTENT_LAST for the range endpoint, not the file's end. Record the requested interval, domain, status and buffer capacity before interpreting an empty or apparently final result. [16]

Constructed example: a query for bytes [2048, 4096) may return an extent [0, 8192). Its reported length is 8192 bytes; its logical overlap with the query is 2048 bytes. This is interval arithmetic, not a filesystem measurement and not physical space saved. Repeated queries can describe the same extent; clipping each response does not deduplicate physical allocation across files.

Native observation, one private file: on ext4 / Linux 6.8.0-146-generic, a 16384-byte file gave 1 data extent and 0 attribute extents for the same query. The returned data extent covered [0, 4096), with LAST set despite the larger file size. Readback preserved every input byte. This is a host-specific observation, not a clone benchmark or a FAST 2020 replication. Inspect the raw result, probe and probe tests. The probe created no extended attributes and requested no raw-device access.

The exact-integer example and its tests use half-open byte ranges. They do not establish mapping completeness or interpret state flags.

FIEMAP mappings may change between calls, and requesting synchronization can change the state being observed. [12] Hesela's measurement recommendation: record the selected paths, tool and kernel versions, warnings, concurrent activity and synchronization policy. Keep extent-level results separate from whole-filesystem metadata and redundancy costs. For the observer effect, see the FIEMAP allocation observation. The command above is an inspection example, not a benchmark executed for this article.

Closing a file can leave copying unfinished

Windows 2000 Single Instance Storage used copy-on-close: edits remained private, while unchanged regions came from a common store. After all users closed a modified file, a worker filled its remaining clean regions. A complete overwrite avoided copying the old contents.[17, sections 2.3.3-2.3.4]

The worker did not delay the close operation. If it ran out of space, SIS retained the reparse point and the unfinished file still depended on the common store. Closing was therefore not proof of a fully materialized, independent file. [17, section 2.3.4]

FAST 2020 distinguishes this whole-file unsharing policy from its copy-on-abundant-write design. Closure and accumulated changes are different triggers; neither is simply another name for a Linux reflink.[1, section 6]

Evaluation implication: time foreground completion and background materialization separately. Record overwrite coverage and any retained backing dependency before reporting copy cost or reclaimable space. This is a source-based measurement recommendation, not a SIS benchmark, a power-loss guarantee or a claim about current Windows support.

A historical SIS link presents private file contents through a sparse NTFS file and a reparse point. Much of its data can reside in the common store. Microsoft treats the reparse payload as opaque to backup software: pass it through the SIS API, rather than interpreting it as a normal pathname link. [18]

Why the paper needed a third page state

The 2000 design used faulted alongside clean and dirty. A mapped page could change without notifying SIS. Ordinary reads therefore needed the link's cache, but a later page-fault read after an unmodified page was discarded needed the common store. Treating both reads alike could expose stale data or the sparse link's zeroes. [17, section 2.3.3]

Restore dependencies are reported once, not necessarily completed

SisRestoredLink may return no backing-file names because they already exist or because it reported them earlier in this restore. Thus a zero count is not a certificate that earlier work succeeded. The API also requires preserving unallocated ranges instead of filling them with zeroes, while restoring allocated ranges and the original reparse data. [19]

After writing a requested common-store file, the application calls SisRestoredCommonStoreFile so SIS can update its internal structures and links. Only the requested backing files should be restored, not every common-store file found on the backup medium. [20]

Hesela's review checklist derived from the documented SIS APIs, not results from a Windows restore experiment.
ObservationStill to establish
The link pathname existsIts sparse ranges and original reparse data were restored correctly.
No new backing names are returnedEarlier requested dependencies were successfully restored or already exist.
A backing file was writtenThe required SIS notification succeeded and logical file contents can be read.

On backup, SisCSFilesToBackupForLink likewise avoids requesting the same common-store data repeatedly. Dependency discovery and successful data transfer are separate responsibilities. [21]

Do not apply exclusions blindly during a volume restore. Microsoft's FilesNotToBackup documentation lists the SIS common store but explicitly says its files must not be deleted when restoring a block-level volume backup. The exception preserves data still needed by links. [22]

Version boundary: the 2000 paper describes deferred copy-on-close; the later common-store overview describes copying before a write. These sources do not establish identical write timing across SIS versions. The restore contract above follows the cited API documentation, not a claim about current Windows support. [17] [23]

An obscure alternative: copy-on-abundant-write

Zhan and colleagues' FAST 2020 How to Copy Files studies a granularity trade-off: coarse copying can amplify small updates, while fine-grained copying can fragment later reads. BetrFS 0.5 buffers changes and delays unsharing until enough work accumulates, a policy called copy-on-abundant-write. Structural maintenance can also trigger unsharing. [1, sections 1-4]

Its Dookubench workload clones a 256 MiB directory, makes 16-byte edits per file, synchronizes, then measures cold-cache scans and space. The platform used a 7200 RPM SATA disk; BetrFS used a modified Linux 3.11.10, competitors 4.9.142. Unless stated otherwise, runs were repeated at least five times; plotted bounds are minima and maxima, not confidence intervals. [1, section 5]

The paper also reports space-accounting noise from background cleaning, including decreases after some rounds. A before/after delta mixes the foreground workload with concurrent reclamation; it is not automatically the clone's isolated allocation cost. [1, section 5.1 and table 1]

Section 4 separates node reclamation from query-oriented background cleaning. The latter was changed to avoid flushing into multiply referenced nodes, because doing so could break sharing. These are different maintenance policies, not one generic garbage collector. [1, section 4]

These are historical prototype results, not measurements of modern XFS, Btrfs or NVMe. We have not reproduced them. The useful research question is whether cloning, modification and subsequent reads can all remain efficient.

Measure the lifecycle, not just creation

Hesela's proposed comparison worksheet. These are questions for a controlled experiment, not reported benchmark results.

StageRecordQuestion answered
CreateRequested API, fallback, elapsed time, file count.Did the intended operation actually run?
ModifyChanged bytes and offsets, write latency, explicit persistence step.What does making each clone different cost?
Read againSame scan/query, cache state, latency distribution.Did later access become more expensive?
MaintainDefragmentation scope, compression policy, sharing and headroom.Did a rewrite change allocation without changing logical bytes?
Retain and reclaimShared/private allocation, free space, retained history, cleanup time.When is space consumed and returned?

Choose the application-level comparison first: for example, a prepared test workspace becoming usable after its expected edits. Keep source contents, destination state, filesystem options, compression and persistence requirements fixed. Randomize run order, preserve individual observations and explain exclusions. Treat fallback copies as a separate group rather than averaging them into clone timings.

A syscall trace can help identify a requested mechanism, but tracing changes timing. Use a separate diagnostic run. Avoid machine-wide cache dropping on a shared or production host. Any cold-cache protocol belongs on an isolated test system with its effects documented.

File isolation is not a complete backup contract

A sequence of individually consistent file clones can combine different moments of a changing application. Our inference from the per-file contract: application coordination or an appropriate multi-object snapshot mechanism is still needed. Nor does logical isolation protect against loss of the shared filesystem.

Start with snapshot and backup failure boundaries and verify an actual restore. Definitions: reflink, copy_file_range and copy-on-write.

Primary sources and scope

  1. Zhan et al. (2020), How to Copy Files, FAST 20, pp. 75-89, sections 1-5
  2. Linux man-pages 6.19: FICLONE(2const), sharing and concurrent-write atomicity
  3. Linux man-pages 6.19: copy_file_range(2), return values, acceleration and version boundaries
  4. GNU coreutils: cp invocation, --reflink behavior and shared-block errors
  5. Linux man-pages: fallocate(2), FALLOC_FL_UNSHARE_RANGE
  6. Btrfs-progs v6.16: Defragmentation, extent sharing and compression
  7. Btrfs-progs v6.16: Compression, new writes and operation-local policy
  8. Btrfs-progs v6.16: filesystem defragment, traversal, extent targets and reservations
  9. Btrfs-progs v6.16: filesystem-du.c, extent exclusions, set accounting and traversal warnings
  10. compsize v1.5: whole-extent compression accounting and referenced bytes
  11. Linux FIEMAP documentation: request flags and mappings changing between calls
  12. Linux man-pages: FIDEDUPERANGE, compare-and-share and per-destination results
  13. Linux v6.18: remap_range.c, length rounding and historical bytes_deduped reporting
  14. Linux v6.12: ioctl.c, FIDEDUPERANGE validation and copying results to userspace
  15. Linux v6.18 FIEMAP: XATTR query domain and returned extents crossing requested bounds
  16. Bolosky, Corbin, Goebel and Douceur (2000). Single Instance Storage in Windows 2000, USENIX Windows Systems Symposium, pp. 13-24, sections 2.3.3-2.3.5.
  17. Microsoft: SisRestoredCommonStoreFile, reporting restored backing files
  18. Microsoft: FilesNotToBackup, SIS exception for block-level volume restores
  19. Microsoft: The SIS Common Store and Common-Store Files
  20. NVM Command Set 1.1: section 3.3.2 and Figure 114. Copyright 2008-2024 NVM Express, Inc. All rights reserved.
  21. nvme-cli v2.15: Copy command, source namespaces and descriptor format

Deduplication results reviewed 20 October 2026 against the cited Linux versions. Earlier source review: 15 October 2026; Btrfs additions checked 16 October 2026 against btrfs-progs v6.16 documentation. This is a pinned reference, not a newest-version claim. API details follow Linux man-pages 6.19; actual support depends on kernel and filesystem. No new performance, failure-rate or recovery measurements are claimed.

Published by Hesela team · Published · Updated

Report a correction · Editorial standards · Reuse guidance

Change history

: first published.

  1. · Update: Distinguished FIEMAP data and extended-attribute queries, added exact logical-range accounting, and aligned visible revision dates with metadata.

: latest recorded update. A detailed change note is not available for this revision.

New-publication RSS · Correction RSS

Cite this page
Hesela team. Fast file clones: where the copying cost goes. Hesela. 2026-11-08. https://hesela.com/analyses/file-clones-deferred-copy-cost/