Does APFS actually support Named Forks or just Resource Forks and Extended Attributes?

1.1k views Asked by At

From version 8.1 until Mountain Lion (10.8), the OS supported a concept called "Named Forks". Named forks are equivalent to "Alternate Data Streams" in Windows.

There is a ton of confusion on the internet now between named forks vs the resource fork and between named forks vs extended attributes. This is the timeline to show they are all separate concepts:

  • 1984 1.0 : MFS : Data Fork + Resource Fork
  • 1985 2.1 : HFS : still only Data + Resource Forks
  • 1988 8.1 : HFS+ : support for Named Forks added
  • 2005 10.4 Tiger : HFS+ : Extended Attributes added
  • 2013 10.9 Mavericks : HFS+: Named Forks deprecated
  • 2017 10.13 High Sierra : APFS
  1. There have always been data forks and resource forks on all OS versions and all Apple filesystems. These days the only place the OS seems to use resource forks is when giving a folder a custom icon. That creates a file called Icon\r with a zero-length data fork and image data in the resource fork. The filename includes an actual carriage return character!

  2. Named forks were supported for 7 years before extended attributes were introduced.

  3. HFS+ definitely supported both named forks and extended attributes for 8 years, though I don't know if one file could have both, or whether they are the same thing that manifest as named forks prior to Mavericks and as extended attributes from Mavericks on.

  4. Named forks were deprecated 4 years before APFS was introduced.

Named forks were never much used. I wrote code to try to call FSCreateFork on files and dirs. It always fails with error -1402 "Fork name parameter is bad" whether on an HFS+ or APFS volume, whether I run it under Big Sur or Sierra. I don't have access to other OS versions.

So since I can't find a way to test it, and since the information on the net is a muddled mess, I can't Google it.

Are there any experts here who do know whether APFS supports named forks?

1

There are 1 answers

2
MichaelR On

A quick test illustrates that resource forks work with Big Sur on APFS, but arbitrary named forks don't seem to:

$; echo "data fork" > test.txt
$; echo "resource fork" > test.txt/..namedfork/rsrc
$; cat test.txt
data fork
$; cat test.txt/..namedfork/rsrc
resource fork
$; echo "resource fork" > test.txt/..namedfork/other
-bash: test.txt/..namedfork/other: Not a directory
$;

More importantly, the Apple File System Reference describe the internal structures on APFS and it details two inode flags INODE_HAS_RSRC_FORK and INODE_NO_RSRC_FORK. No reference to any other types of forks or naming of forks, so I think we can fairly safely say that named forks do not exist on APFS.