简体   繁体   中英

macOS with APFS: Copy-On-Write in Terminal

I am writing some little script that assembles backup data into one directory. The directory content will then be uploaded to a cloud service and after that we can remove it. I was wondering how one could utilize APFS' copy-on-write feature with a command like cp in Terminal.

The Finder does a great job. But if I run cp Largefile LargeFileCopy it takes forever to copy the file and also uses the space accordingly.

I found it myself.

On macOS, cp supports the -c option. cp -c Largefile LargeFileCopy will then use the new clonefile(2) library and immediately return without using any additional space on the device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM