[HN Gopher] What should we know about APFS special files?
       ___________________________________________________________________
        
       What should we know about APFS special files?
        
       Author : ingve
       Score  : 30 points
       Date   : 2024-01-03 07:39 UTC (1 days ago)
        
 (HTM) web link (eclecticlight.co)
 (TXT) w3m dump (eclecticlight.co)
        
       | transpute wrote:
       | APFS originated on iOS, but iOS cannot enable APFS encryption on
       | an external USB-c drive. However, iOS can unlock a macOS-
       | encrypted external drive.
       | 
       | There are small enclosure for mSATA or NVME 2230 SSD, with the
       | form factor of a flash drive, and the speed and reliability of an
       | SSD.
        
       | gmac wrote:
       | I am all in on the Mac, but I hate APFS -- or at least the way
       | it's exposed by the Finder. There's no longer any obvious
       | relationship between deleting stuff and getting disk space back,
       | and at any one time you can find a range of _different_ numbers
       | in different places to tell you how much space is used and how
       | much free.
       | 
       | As it says in the post: "Magic works best when the spectator
       | either knows nothing about the sleight of hand involved, or is
       | another skilled magician". APFS in the Finder makes both
       | impossible.
        
         | GeekyBear wrote:
         | > There's no longer any obvious relationship between deleting
         | stuff and getting disk space back
         | 
         | Special file types have been around in other file systems for a
         | long time now.
         | 
         | For instance, Hard Links have been a thing on NTFS disks since
         | the first version of Windows NT.
         | 
         | Deleting a hard link for a file on on an NTFS disk doesn't
         | result in freeing any space, until you delete all the hard
         | links as well as the original file.
        
           | inferiorhuman wrote:
           | As far as I can tell that's not what the issue is. For
           | instance I can delete a file and watch the free space dip 20x
           | the size of the file.
        
       | llimllib wrote:
       | I've found a use for APFS' copy-on-write cloned files.
       | 
       | I like to work with git worktrees, and I work on an app that has
       | a large (2 gb) node_modules directory.
       | 
       | Previously, every time I made a worktree, I had to `npm install`
       | to get a fresh node_modules, or copy the full directory, which
       | was slow.                   $ time /bin/cp -r node_modules
       | /tmp/node_modules         /bin/cp -r node_modules
       | /tmp/node_modules  1.98s user 58.26s system 63% cpu 1:34.17 total
       | 
       | The -c option to /bin/cp on a mac is "copy files using
       | clonefile(2)", making clones instead of full copies. It's still
       | not super fast, but almost a minute less of waiting for the copy
       | is a nice improvement:                   $ time /bin/cp -rc
       | node_modules /tmp/node_modules_cloned         /bin/cp -rc
       | node_modules /tmp/node_modules_cloned  0.43s user 29.85s system
       | 79% cpu 38.211 total
       | 
       | The one downside is that GNU has an incompatible option for
       | creating clones (`--reflink`), leading to this very ugly
       | conditional:
       | 
       | https://github.com/llimllib/personal_code/blob/0e1034f13b31f...
        
       ___________________________________________________________________
       (page generated 2024-01-04 23:00 UTC)