Skip to content
New issue

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

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

Already on GitHub? # to your account

downloader.copyLocal should use Clonefile on macOS #1411

Closed
jandubois opened this issue Mar 8, 2023 · 3 comments
Closed

downloader.copyLocal should use Clonefile on macOS #1411

jandubois opened this issue Mar 8, 2023 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@jandubois
Copy link
Member

jandubois commented Mar 8, 2023

Description

Most of the copies made by downloader will remain identical copies of files in the cache (e.g. basedisk), and the files are often quite large.

On macOS (with apfs) using unix.Clonefile instead of fs.CopyFile will be much faster and save disk space, as the copy will point to the same datablocks as the source until they are modified (via "Copy on Write"). Only file metadata is copied.

Clonefile was added to x/sys/unix in golang/sys@2334cc1

@jandubois jandubois added the enhancement New feature or request label Mar 8, 2023
@afbjorklund
Copy link
Member

afbjorklund commented Mar 8, 2023

There is reflink on Linux, but only on select filesystems. (i.e. btrfs or xfs)

https://github.com/KarpelesLab/reflink

Seems like reflink.Auto could work ?

"Other OSes have similar features, to be implemented in the future." (2020)

@AkihiroSuda
Copy link
Member

This should be implemented in

@AkihiroSuda
Copy link
Member

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants