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

Support COW filesystems for efficient copy #17

Open
yarikoptic opened this issue Dec 13, 2023 · 0 comments
Open

Support COW filesystems for efficient copy #17

yarikoptic opened this issue Dec 13, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@yarikoptic
Copy link

On some filesystems with CoW (copy on write) support (e.g. BTRFS), it is possible to very efficiently (not using much of new space) and quickly (does not need to copy actual data) copy files within the same partition.

could probably be done by default for copy operation if filesystem could potentially support it.

❯ cp --help | grep 'When --reflink' -A3
When --reflink[=always] is specified, perform a lightweight copy, where the
data blocks are copied only when modified.  If this is not possible the copy
fails, or if --reflink=auto is specified, fall back to a standard copy.
Use --reflink=never to ensure a standard copy is performed.

e.g,. on a sample 1GB file on local already fast SSD (after a number of warm up runs)

❯ rm -f OUT; time cp -L --reflink=never neuronets-kwyk--version-0.4-gpu.sing OUT
cp -L --reflink=never neuronets-kwyk--version-0.4-gpu.sing OUT  0.00s user 0.24s system 99% cpu 0.238 total

vs

❯ rm -f OUT; time cp -L --reflink=always neuronets-kwyk--version-0.4-gpu.sing OUT
cp -L --reflink=always neuronets-kwyk--version-0.4-gpu.sing OUT  0.00s user 0.00s system 73% cpu 0.001 total

so here over 100x times faster ;-) and on even larger files would only be better

Here is our helper to do so in dandi: https://github.com/dandi/dandi-cli/blob/HEAD/dandi/utils.py#L371

@LuciMoore LuciMoore added the enhancement New feature or request label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants