I am also concerned with finding a way to backup Apple's HFS+ and APFS filesystems to some other *nix filesystem. The problem is that they are very complicated, with each file being a complex data structure composed of a so-called "data fork," "resource form," and Finder metadata. The standard backup tool, rsync
, will not recognize these various components of your files. This is a very partial answer, according to what I have found so far.
There is a project called rsync+hfsmode
that will handle this properly, at least for HFS+, but it does it by creating two files on the backup drive, filename
, containing the data fork, and ._filename
containing the resource fork and Finder metadata. Furthermore, when copying back to an HFS+ disk, a second step is needed to reconstitute those two files into a proper HFS+ data structure. You can see a more complete discussion at the project page. I am not clear if this will work for APFS, though the question asked on the Apple Developer Forum was responded to with utter silence.
In looking for other solutions, it appears that dar
(Disk Archiver) can also handle at least some of the unique characteristics of MacOS filesystems (they do not distinguish between HFS+ and APFS). According to their Features page.
EXTENDED ATTRIBUTES (EA) references: MacOS X FILE FORKS / ACL Dar is able to save and restore EA, all or just those matching a given pattern.
File Forks (MacOS X) are implemented over EA as well as Linux's ACL, they are thus transparently saved, tested, compared and restored by dar. Note that ACL under MacOS seem to not rely on EA, thus while they are marginally used they are ignored by dar.
FILESYSTEM SPECIFIC ATTRIBUTES (FSA) references: MacOSX/FreeBSD Birthdate, Linux FS attributes
Since release 2.5.0 dar is able to take care of filesystem specific attributes. Those are grouped by family strongly linked to the filesystem they have been read from, but perpendicularly each FSA is designated also by a function. This way it is possible to translate FSA from a filesystem into another filesystem when there is a equivalency in role.
currently two families are present: HFS+ family contains only one function : the birthtime. In addition to ctime, mtime and atime, dar can backup, compare and restore all four dates of a given inode (well, ctime is not possible to restore)
For the purposes of your question, you will in addition want to know how to represent all of this data in a usable way on some linux FS. Clearly the Finder data is of no use, and you will have to lose the "birthtime" attribute, whatever that is, because that is not tracked in Linux. What relevance the resource fork has, I am not clear. I do know that there is some Mac software will only run on Apple filesystems. (The one I've come across was image editing software, whose name I've forgotten.)
I welcome all additions and edits, as I need this answer myself.