One of the more developer oriented announcements that did not make the Keynote in this year’s WWDC was Apple introducing a new file system christened Apple File System (APFS).
The current file systems being used by the company, (HFS and HFS+), are more than a decade old, and were never really designed for storage devices storing data in the order of Gigabytes.
APFS has been developed “from-scratch” to scale uniformly across all their devices. This means that from the Apple Watch to the Mac, all devices will use APFS as their default file system in the coming years.
What features can you expect in the new file system, and how do they matter on a user level? We have a simple analysis of the major new features in APFS as announced by the tech giant.
Nanosecond Timestamp Granularity:
The currently used HFS+ file system has support for 1 second timestamp granularity. This basically means that the timestamps (read “file created on”, “last modified on”) on your files in an HFS+ system are accurate to a second. This was all well and good when HFS+ was originally designed, almost 13 years back, for storage devices that were slow and 1 second timestamps could easily manage the atomicity of the file system.
However, the storage devices being used in the current generation of devices are capable of I/O operations at the nanosecond level making nanosecond timestamp granularity a necessity in a modern file system.
Encryption:
One of the key features in Apple File System, and perhaps the most useful, even for non power users, is encryption. APFS offers users three options for how to (if at all) encrypt their data.
-
Unencrypted:
A user can simply opt to not encrypt their data at all. This is probably not the best way to go about your files if you have any sensitive data on your laptop; any at all.
However, to each their own, so you can keep your files unencrypted.
-
Single Key Encryption:
Single key encryption on your device will work the same way as FileVault works on a Mac right now. It will encrypt your data, requiring a key to access it.
-
Multi-Key Encryption:
Simply put, multi-key encryption is awesome. Multi key encryption on APFS will allow users to create multiple keys for different files, or even parts of files. So, your entire disk will be encrypted, but you can create additional keys (say, on your phone), to reveal even more data when your phone gets unlocked, thereby giving you access to the key. This is an exciting new addition to APFS as it will allow encryption on a “per-file” basis, so different files can have different encryption keys.
Sparse Files:
Sparse files allow memory to be allocated to a file only when needed. Supporting sparse files means that a large file (say 1GB) will only be allocated the entire 1GB space on the storage device when the actual data in the file is 1GB in size. For example, consider the use case where you are downloading a file using a torrent. The file may be a large file, say 1 GB. In HFS+ file system, the moment the file starts downloading, the file system allocates 1GB of space to the file, even if the actual data that might have been downloaded (and hence, saved) may be as little as a single kilobyte.
APFS, however, will not allocate the entire 1GB right at the beginning. Instead, the file will be allocated disk space as it grows.
Snapshots:
“Snapshots”, as the name implies, basically lets you take a snapshot of a file at a particular moment, therefore saving the state of the file, and letting you continue editing it. Changes are tracked by the file system, and only new data takes up additional space. Snapshots are faster than typical file saves. A typical file save, which saves the entire data of the file every time the user “saves” the file, takes time proportional to the size of the file.
A snapshot, on the other hand, only saves the changes every time the user “saves” the file. This allows backups to use less disk space than on non-snapshot supporting file systems. This means that TimeMachine backups will become faster, more efficient, and occupy less space as well.
Space Sharing:
Space sharing is a new feature in APFS that will allow multiple volumes to logically share memory space on a storage device. What this means, is if you have a 256 GB SSD on your Mac, APFS will let you partition it in such a way that each of the partitions will show the entire 256 GB (or the size you choose) as available for use and will expand or shrink in physical size when files are added or removed from the partitions.
Space Efficiency:
Efficient storage of files on a storage device is of utmost importance for better performance as well as more efficient use of the file system.
APFS handles space efficiency using what are called “Clones”. Basically, if you copy a file within the same file system, instead of creating a duplicate copy of the data, APFS simply shares the same on-disk data with the new file. This means that multiple copies of the same file will no longer use additional space “per-file”.
Performance:
Apple has made some “under-the-hood” improvements to APFS to make it perform better on their devices.
APFS is optimised for Flash storage. This is the storage used on every new Apple device being sold to users and it makes sense for their file system to be optimised according to the storage technology they use.
Also, APFS uses what is called “TRIM”. TRIM is a command used by the Operating System to inform the SSD which blocks of data are no longer in use and can be cleared. TRIM will allow the SSD to “mark” the blocks of memory that no longer contain valid data, so when new data is needed to be written, the SSD can use the marked blocks. This results in a higher write speed.
While this feature was available in HFS+, APFS allows TRIM commands to be issued asynchronously when files are deleted or free space is reclaimed. This ensures that the changes to metadata are written to the storage before the deletion or reclaim operations are carried out.
If you have used a Mac, chances are that you have encountered the spinning beach ball, more commonly known as the “spinning beachball of death”. This usually occurs when the OS is making multiple write operations on the SSD. With APFS, Apple will make the file system prioritise the operations that are immediately visible to the users, as compared to background tasks that are not visible.
Feature Contrast Between HFS+ and Apple APFS
Feature | HFS+ File System | APFS File System |
---|---|---|
Sparse File Support | No | Yes |
TRIM | Yes | Yes (also asynchronous) |
Inode Numbers | 32 bit | 64 bit |
Space Sharing | No | Yes |
Clones | No | Yes |
Snapshots | No | Yes |
SEE ALSO: How To Lock and Password Protect Files, Folders On Mac
Excited About APFS?
Apple’s effort towards developing a completely new file system from the ground up sounds like a good idea; especially considering that they are developing it targeted solely at Apple hardware, meaning APFS will probably attempt to use the hardware in the best possible way, especially the blazingly fast flash storage on Apple devices. This should be a decent improvement from the many nuances of HFS+ when Apple finally releases the APFS file system in late 2016 or early 2017.
We are really excited about APFS and how it will improve the way our Apple devices handle files and directories.
What do you think of APFS? Let us know in the comments below.