DEV Community

Cover image for APFS File System Overview: Why It Is Better Than HFS+
Michael Mirosnichenko
Michael Mirosnichenko

Posted on

APFS File System Overview: Why It Is Better Than HFS+

Read this article about APFS file system, its characteristics, advantages and downsides, and find out how it is better or worse than HFS+.

Introduction

HFS+ came into usage in early 2000s and was soon outdated, as it was only an improved version of HFS. It made simple operations too long, and didn’t use device memory efficiently. To solve these and other issues, the new APFS system was designed. It introduced considerable changes in comparison with the predecessor.

Image description

Image description

Cloning and compression

Thanks to the new functions such as cloning (copying a file or directory instantly, which doesn’t require additional disk space to store data) and compression (which helps to save disk space and increase write speed), the overall system performance has improved. Now applications can open faster and the overall system response time has been reduced.

One more advantage is quick copying while saving disk space. Clones are created but they take as much space as required for one file, instead of the two. If there are any changes made to the clone, only changed data is written to disk, while the rest of the file is based on its original version. This simple algorithm helps to save disk space considerably.

YouTube:

Snapshots

Thanks to using snapshots (point-in-time, read-only instances of the file system) backup operations take much less time. Now the operating system can use snapshots to make backups more efficient, which lets Time Machine work faster.

64-bit architecture

Unlike HFS+ based on 32-bit architecture, APFS uses 64-bit structure. In simple words, APFS can store a lot more files than its predecessor: about 9 quintillion files in every volume, which must be more than enough for a dozen of years.

Disk encryption

In addition to the generally faster and more stable operation, users will gain access to secure disk encryption tools. Any files can be protected with one or several keys.

Space Sharing

With the Space Sharing feature, all volumes of a disk can share their free space. For example, if a volume has insufficient space to accommodate a file, it will use some space from another volume automatically.

Here is how the file system is designed: the operating system creates a container on the hard disk. This container holds one or several partitions (volumes), each of them having its own structure (the space of names, and a set of files and directories) for storing data, links to file and folder locations, and the root directory containing the data.

In comparison to its predecessor, HFS+, if you format the disk to have one or several volumes, the new file system assigns a fixed size to every volume, and this size is determined at the time of creation. Under certain conditions, this size can be modified without losing data, but too often, such conditions do not apply to the size you’d like to enlarge.

APFS removes most of those size limitations and lets volumes to make use of any free space available on the disk. This way, any space which is unused can be assigned to any volume where it is needed. There is only one exception – volumes have to be located inside one container.

YouTube:

New timestamps

Enhanced features for working with removable devices let users transfer and read information much faster which reduces the number of possible write errors.

In APFS, the accuracy of timestamps has been improved considerably, and now it supports time stamping accurate to the nanosecond, While HFS+ was limited to a second timestamp resolution.

Journaled operations

Here is one more improvement: APFS uses the “copy-on-write” principle to guarantee that all changes and entries to the journal will get synchronized all the time, and if the operating system crashes unexpectedly or there is a power-off, nothing at all is going to happen to the data on your disks.

It applies both to the desktop-designed macOS and mobile iOS platforms – thanks to APFS, iPhone will no longer get bricked if something goes wrong with another update.

As ApFS is optimized for SSDs, the speed of access to the flash drive will be considerably higher when compared to HFS +.

For conventional hard disks, though, the increase in performance will be insignificant. Test results for an ordinary HDD:

Image description

Conclusion

All in all, it can be said that APFS appears to be much better than the previous file systems, as it was designed with SSDs in mind and should perform amazingly on new Apple devices. In the end, the new operating system guarantees improved performance, better security thanks to the built-in encryption technology, and enhanced reliability due to the new crash protection mechanism and the simplified data backup plan.

Top comments (0)