Sparse files, which have equivalents on many other modern file systems, have to be created using specific system calls, and then store only the non-empty data in a file which could effectively be very much larger than the sparse file. That can lead to significant increases in the storage space required. Copying strategies therefore have to assume both are different files with no common data, which expands the size of the copy, and prevents clones from being reconstituted when copied back to APFS.
When a cloned file is modified, the file system maintains the clone relationship as long as it can, saving only changed storage blocks, until they all differ between the two files, and they are no longer clones at all.ĭetecting clone files has only recently become possible, and even now it’s almost impossible to tell how much data is common to the original and its clone. The two remaining problems encountered when copying all APFS volumes are space-saving devices, clone and sparse files.Ĭlone files are normally created when copying or duplicating a file within the same volume (file system), and work like hard links, except that the two references to the same data have different inodes. Compressed files are still supported, but remain confined to system files. Most, though, are quarantine or macl xattrs, which are considered ephemeral and normally stripped when copying files to another volume. The good news is that it doesn’t support directory hard links the bad news is that extended attributes are becoming even more widely used, to the point where few documents now lack them. One minor footnote here is that HFS+ also supports compressed files, although those are confined to system volumes, as Apple never made them available to third-parties.Īs a modern file system, APFS uses several techniques which have equivalents on other modern file systems, but which are often slightly different there, so requiring conversion. On more sane file systems which don’t support them, there’s no equivalent, which is one reason why Time Machine can’t convert existing backups on HFS+ to its new APFS format.
Time Machine backups to HFS+ volumes invariably contain large numbers, as they avoid replicating many hard links, when creating the image that each backup is a complete copy of the original. A directory hard link works the same as a normal hard link, only it links to a whole directory instead of a file. HFS+ is one of very few file systems which use these, as most self-respecting file system engineers realise the problems they produce.
The other, and more serious, problem are directory hard links, although they’re only likely to be encountered when copying Time Machine backups, which depend on them. Unless arrangements are made for the preservation of enduring extended attributes, and their reattachment when copying them back, some files will be irreparably damaged. Unfortunately, that system isn’t generally used, and is little-known too.
These started in Classic Mac days as resource forks, which are still used, but are only one of hundreds of types of extended attribute.Įxtended attributes may contain special flags indicating whether they’re ephemeral, and should be ignored when copying, or whether they should be preserved. The most prominent are extended attributes, arbitrary metadata which are normally stored separately from the file data itself.
This may be an old file system, but it holds two nasty surprises when trying to copy it. This article considers some of those problems, so that you know what you’ve got to deal with. Underneath the surface of the two native Mac file systems lurk crocodiles ready to catch the unwary who assume that they can readily be copied to other file systems. Backing up a Mac, or just making a faithful copy of files stored on one of its volumes, isn’t as easy as it might seem.