-
Notifications
You must be signed in to change notification settings - Fork 21
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
Reflink(Copy On Write)支持 #38
Labels
enhancement
New feature or request
Comments
def cpcow(src_path, dst_path):
if os.path.isfile(src_path):
f11 = open(src_path,'r')
f1 = f11.fileno()
f21 = open(dst_path,'w+')
f2 = f21.fileno()
os.copy_file_range(f1, f2, os.path.getsize(src_path))
elif os.path.isdir(src_path):
os.makedirs(dst_path)
for ww in os.listdir(src_path):
cpcow(src_path+ "/" + ww,dst_path + "/" +ww)
t1 = time.time()
cpcow("/home/tksmly/Downloads/world", "./ww")
print(time.time() - t1) 没有原生的目录复制 |
Merged
closed as the PR is merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://btrfs.readthedocs.io/en/latest/Reflink.html
https://docs.python.org/dev/library/os.html#os.copy_file_range
对btrfs,xfs,zfs等支持cow的文件系统可以大幅度缩短复制时间
https://docs.python.org/zh-cn/3/library/shutil.html#shutil.copy
似乎shutil.copy并不支持这一特性
在我的存档中,cp -r --reflink耗时不到1s,而cp -r --reflink=never需要60s左右
The text was updated successfully, but these errors were encountered: