Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zfsconcepts: add description of block cloning #15362

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

robn
Copy link
Member

@robn robn commented Oct 6, 2023

Motivation and Context

There's almost no documentation for block cloning. People will have questions. We should at least have something to point people at.

Description

Here I'm trying to succinctly introduce the concept, the basics of its construction, how its different to dedup, how to use it, and where its limitations lie, in four paragraphs and with enough searchable terms to help the reader find more information both within OpenZFS and elsewhere.

Sponsored-By: Klara, Inc.

How Has This Been Tested?

checkstyle (mancheck) passes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Here I'm trying to succinctly introduce the concept, the basics of its
construction, how its different to dedup, how to use it, and where its
limitations lie, in four paragraphs and with enough searchable terms to
help the reader find more information both within OpenZFS and elsewhere.

Phew.

Sponsored-By: Klara, Inc.
Signed-off-by: Rob Norris <[email protected]>
@robn
Copy link
Member Author

robn commented Oct 6, 2023

Rendered:

Block cloning

Block cloning is a facility that allows a file (or parts of a file) to be “cloned”, that is, a shallow copy made where the existing data blocks are referenced rather than copied. Later modifications to the data will cause a copy of the data block to be taken and that copy modified. This facility is used to implement “reflinks” or “file-level copy-on-write”.

Cloned blocks are tracked in a special on-disk structure called the Block Reference Table (BRT). Unlike deduplication, this table has minimal overhead, so can be enabled at all times.

Also unlike deduplication, cloning must be requested by a user program. Many common file copying programs, including newer versions of /bin/cp, will try to create clones automatically. Look for “clone”, “dedupe” or “reflink” in the documentation for more information.

There are some limitations to cloning. Only whole blocks can be cloned, and blocks can not be cloned if they are not yet written to disk, or if they are encrypted, or the source and destination recordsize properties differ. The OS may add additional restrictions; for example, most versions of Linux will not allow clones across datasets.

@behlendorf behlendorf added Type: Documentation Indicates a requested change to the documentation Status: Accepted Ready to integrate (reviewed, tested) labels Oct 6, 2023
@behlendorf behlendorf merged commit 5b8688e into openzfs:master Oct 6, 2023
19 of 25 checks passed
@allanjude
Copy link
Contributor

maybe change:

most versions of Linux will not allow clones across datasets.
to
most versions of Linux will not allow blocks to be cloned across datasets.

Just to avoid confusion with zfs clone

Copy link
Contributor

@allanjude allanjude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Allan Jude <[email protected]>

behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Oct 6, 2023
Here I'm trying to succinctly introduce the concept, the basics of its
construction, how its different to dedup, how to use it, and where its
limitations lie, in four paragraphs and with enough searchable terms to
help the reader find more information both within OpenZFS and elsewhere.

Phew.

Sponsored-By: Klara, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes openzfs#15362
behlendorf pushed a commit that referenced this pull request Oct 7, 2023
Here I'm trying to succinctly introduce the concept, the basics of its
construction, how its different to dedup, how to use it, and where its
limitations lie, in four paragraphs and with enough searchable terms to
help the reader find more information both within OpenZFS and elsewhere.

Phew.

Sponsored-By: Klara, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #15362
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Dec 12, 2023
Here I'm trying to succinctly introduce the concept, the basics of its
construction, how its different to dedup, how to use it, and where its
limitations lie, in four paragraphs and with enough searchable terms to
help the reader find more information both within OpenZFS and elsewhere.

Phew.

Sponsored-By: Klara, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes openzfs#15362
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested) Type: Documentation Indicates a requested change to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants