4 ms·
Ask HN: Do you feel anxiety if you don't use the -c flag when using cp on macOS?
I think this is something macOS should do automatically whenever it can. You shouldn't have to specify this flag manually.
- deleted 2y ago[deleted]
- watersb 2y agoThe `-c` flag enables a fast "clone" of the file on APFS, Apple's current filesystem. That operation is very fast, as it is like a directory entry adding another pointer to the existing data. But unlike a simple "hard link", any future modifications to this clone will write distinct data blocks to.the filesystem: the original and the clone are independent files, they just share any blocks that store data in common.
- beardyw 2y agoIn what context would you not want that?
- compressedgas 2y agoIn a related context Pádraig Brady writes: > For robustness reasons one may want a copy to take place to protect against data corruption. Also for performance reasons you may want the writes to happen at copy time rather than some latency sensitive process working on a CoW file and being delayed by the writes possibly to a different part of a mechanical disk. https://unix.stackexchange.com/questions/80351/why-is-cp-reflink-auto-not-the-default-behaviour https://unix.stackexchange.com/questions/80351/why-is-cp-ref...
- gregjor 2y agoIf it bothers you that much make an alias. In your .profile or .bashrc (or whatever your shell reads at startup): alias cp=“cp -c” Or give it another name if you like.
- amichail 2y agoAnd what about the anxiety that you feel when you learn about the -c flag after having used cp quite a lot without it on macOS?
- gregjor 2y agoI don’t feel anxious about things like that. If I did I would find the large files on my Mac, check if I have multiple identical copies of any of them, then cp -c to make new copies. But disk space is cheap so mainly I wouldn’t worry about it. The -c flag is MacOS specific and I don’t use a Mac.
- amichail 2y agoThe anxiety pertains to the excess wear on the SSD caused by writing more data.
- gregjor 2y agoI don’t think that’s worth worrying about. No amount of worry will extend the life of the SSD. But you can backup your files to cloud storage or an external drive so if the SSD does wear out you don’t lose anything important.