Why do iCloud Drive files take up twice as much space on Finder Info and how does it support hardlinks?
Cool undocumented iCloud Drive feature and issue! 2Q: Why (and when) do files on iCloud Drive (as reported by Finder Info) take up twice as much space as normal? And why/how does iCloud Drive sort of support hardlinks? CoW? I'd read that they're not supported at all, but that's not so.
I was curious about hardlinks, and surprised by what I found after my own testing after reading iCloud Hardlinks - Apple Community, which leads me to ask two questions:
:
I noticed very strange "on disk" filesize of this file:
The video file started off on my iPhone / sync'd to iCloud. As my phone was low on free space, and the video was 3.5GB, I copied the video to a folder on my iCloud Drive. (Yes I have Optimize iPhone Storage on, but Photos still take up a lion's share of my iPhone storage.) Then I noticed that Finder Info reports it takes up 7.13 GB "on disk". (as seen in screenshot above)
Why is that? If I copy it to the local hard drive, Finder Info shows a normal size:"3,563,275,579 bytes (3.56 GB on disk)"
I was surprised that ln DID work on iCloud Drive to create both hard and soft links:
321962340 -rw-------@ 2 elvey staff 3563125195 May 11 10:44 /Users/elvey/Library/Mobile Documents/com~apple~CloudDocs/Big (Videos off iPhoto Cloud)/42 since 2024 off Mac.Export/February 25, 2024/IMG_0353.HEATHROW VIRGIN NIGHTMARE.hardlink.MOV
322072952 lrwxr-xr-x 1 elvey staff 147 May 12 00:26 /Users/elvey/Library/Mobile Documents/com~apple~CloudDocs/Big (Videos off iPhoto Cloud)/42 since 2024 off Mac.Export/February 25, 2024/IMG_0353.HEATHROW VIRGIN NIGHTMARE.ln.MOV -> /Users/elvey/Library/Mobile Documents/com~apple~CloudDocs/Big (Videos off iPhoto Cloud)/42 since 2024 off Mac.Export/February 25, 2024/IMG_0353.MOV
321962340 -rw-------@ 2 elvey staff 3563125195 May 11 10:44 /Users/elvey/Library/Mobile Documents/com~apple~CloudDocs/Big (Videos off iPhoto Cloud)/42 since 2024 off Mac.Export/February 25, 2024/IMG_0353.MOV
The output of ls -li shows both files have the same inode: 321962340. Also, if I used cat with >> to append one of the files, both of them grew. So iCloud Drive DOES have at least some de facto support for links!? How much? Documented?
cat /bin/sh >> /Users/elvey/Library/Mobile\ Documents/com\~apple\~CloudDocs/Big\ \(Videos\ off\ iPhoto\ Cloud\)/42\ since\ 2024\ off\ Mac.Export/February\ 25\,\ 2024/IMG_0353.HEATHROW\ VIRGIN\ NIGHTMARE.hardlink.MOV results in both the original and hard link copy growing, the correct behavior of a hard link. It seems like maybe Boyd confused CoW (Copy on Write) clones with hard links; in other words, maybe they expected CoW behavior from a hard link.
FYI, my goal in using the links was to both have the file have its original name so that the accompanying .xmp file still referred to the file under its original name, and also have a version of it with a descriptive title. And to do the same with several large files.
I created it in Terminal with
ln /Users/elvey/Library/Mobile\ Documents/com\~apple\~CloudDocs/Big\ \(Videos\ off\ iPhoto\ Cloud\)/42\ since\ 2024\ off\ Mac.Export/February\ 25\,\ 2024/IMG_0353.MOV /Users/elvey/Library/Mobile\ Documents/com\~apple\~CloudDocs/Big\ \(Videos\ off\ iPhoto\ Cloud\)/42\ since\ 2024\ off\ Mac.Export/February\ 25\,\ 2024/"IMG_0353.HEATHROW VIRGIN NIGHTMARE.hardlink.MOV"
But du reported the hard links as each taking up GB of space.
[Re-Titled by Moderator]
MacBook Air 13″, macOS 12.7