APFS (Apple File System) is a new file system that is used on all Apple devices, from Apple Watch to Mac computers. It is “honed” to flash memory and has replaced the outdated HFS+. Today, almost every new gadget that Apple sells runs on a flash drive, including most Mac computers. When developing the new file system, much attention was paid to improving read and write speeds and overall reliability when it comes to storage and transfer.
- APFS novelties
- The principle of the APFS and the most useful functions
- What are the advantages for users?
- Shortcomings of APFS
- How to open an APFS drive in Windows
- How to recover accidentally deleted or formatted data
So many features have been added to APFS. We don’t even know where to start: optimization for Flash and SSD, data loss prevention in case of disaster by increasing the number of atomic operations, built-in support for several types of encryption, significantly reduced response time, quick assessment of file and folder size – the list can go on and on. In practice, this will provide more stable operation of the operating system, increase the speed of reading/writing data, and further protect user information.
Besides, APFS supports the TRIM command. With this command, the flash drive speed is not reduced, and the amount of free space (with time) is not reduced. “Trimming” notifies the flash drive of what data is not contained in the file system and can be deleted.
The principle of the APFS and the most useful functions
First, we’ll have to deal with a few key terms. Atomic operations are operations performed in a file system or database inseparably and cannot be simplified. An atomic operation cannot be left unfinished if it is interrupted. Such an action is either entirely executed or not at all.
POSIX-compatible safe atomic file saving is performed as follows – when we work with an application and save a file, data from memory is unloaded to a temporary file on disk.
When the application is sure that the data has been uploaded completely and without errors, the application asks the file system for renaming. The renaming operation is atomic and will either be complete or not complete. When renaming, the following happens: the file system moves the temporary file to the save location (for example, from /var/tmp/Batcave_shopping.pages to ~dima/Documents/Batcave_shopping.pages) and then deletes the old data.
However, what if we save a folder or Bundle (e.g., .rtfd or .app, also essentially a folder) rather than a file? Suppose we work with a document ~dima/Documents/AlfredHappyBirthday.rtfd. It is a Bundle. We have text and several images in it. When we make changes and save them, the application overwrites the entire Bundle, not just the changed text or image. The POSIX requirements do not allow us to rename a folder somewhere where data already exists, so we have to resort to tricks. The document is moved from ~dima/Documents/, freeing up space, then the temporary file from /var/tmp/AlfredHappyBirthday.rtfd is renamed to an empty space. This operation is non-atomic and unsafe. If a system error occurs or the computer loses power during the process, the document will be lost.
Such a decision is not desirable. That’s why a new, POSIX-incompatible atomic secure folder saving operation was introduced in APFS. When an application requests to save a folder, the temporary and permanent files are swapped. It is done by the file system, and this operation is atomic.
This is the function of secure Copy-on-write – one of the most important innovations in APFS.
Snapshots are a specific capture of a volume that stores information about the data on that volume at a particular point in time. The easiest way to understand how it works is by example. Suppose we have a volume ( for example, a flash drive) with two presentations. We create a Snapshot of this flash drive. It contains two files Joker.key and Riddler.key. Snapshot itself does not include data from the flash drive – only what files were on it at the time of capture and what they belonged to blocks. The peculiarity of Snapshot is that the blocks recorded in it are closed. They cannot be deleted, moved, or overwritten. So, for example, if we make changes in Joker.key and Riddler.key is removed at all, the original data blocks will remain intact. Although this approach takes up extra free space, it allows APFS to almost instantly return the volume “in time” at the time of any photo creation.
If you need a copy of a file or folder – you right-click on it, and select Duplicate. In HFS+, this means that the file system reads all data and then writes it to the free space. This approach wastes space inefficiently and wastes the disk and CPU. In APFS, when you duplicate data – via Duplicate or simply ⌘C, ⌘V – the file system only copies the hard link to the data, and the content is not duplicated. This operation is called cloning. Thanks to cloning, a duplicate data or folder appears almost instantly and takes up negligible free space. If you make changes to the original or clone, the file system will record the changes and redirect the link accordingly, while the original data remains intact. In APFS, the cloning operation is atomic.
What are the advantages for users?
In addition to faster and more stable operation of the operating system, users will have access to reliable tools for data encryption on disk. With APFS, iPhones will no longer turn into “bricks” after failed updates – Apple will protect data on the drive from damage caused by failures. Finally, using the Space Sharing feature, all volumes on the drive will be able to “share” the free space.
If, for example, the second system (via Bootcamp) you have Windows installed, and you have allocated 100 GB for it, with Apple File System, you no longer have to redistribute the allocated amount of memory manually. If 100 GB is not enough, the system will “take” the necessary amount of free disk space. However, the Clone File and Folder feature will allow you to copy and move data faster.
Shortcomings of APFS
The most important thing is compatibility. If you have a Mac with a Windows partition created by Apple Boot Camp, you will need a particular Windows driver that can read the APFS drive.
Another serious disadvantage is the youngness of the file system itself. Since APFS is only recently released, it still has a long way to go in testing and to perfect to avoid all the bugs, data loss, and other nuances.
How to open an APFS drive in Windows
As with previous versions of file systems developed by Apple, APFS is not supported by the Windows operating system.
If you can at least read data from NTFS on a Mac, no Windows computer will see APFS.
Sooner or later, all owners of several working computers with different operating systems or Mac owners who often run Windows via BootCamp start thinking about it.
The guys from Paragon Software offer a simple and elegant solution to the problem. To befriend opposing file systems, you can use a special utility APFS for Windows by Paragon Software.
APFS for Windows is a system driver for Windows, which allows you to work with drives formatted in APFS fully. It supports both reading data and writing at good speed.
A read-only mount mode is provided for access to important data, protecting the original data from being overwritten. APFS can be mounted even from a disk image.
Both bit-to-bit raw copy disks, and virtual disks of popular formats VMDK,VDI,VHD,VHDX are supported. Developers are already working on .E01 and .Ex0 support.
How to recover accidentally deleted or formatted data
Sometimes, files you have worked on for many hours or other important data may be lost due to power outages, accidental deletion or hard drive formatting. In such situations, the question automatically arises: what to do to recover an important file?
The most natural and most effective method is to use RS Data Recovery application, which allows you to recover a lost file quickly. The app is easy to use and allows you to recover files that were accidentally deleted a few months ago.