1. Overview

In this tutorial, we’ll discuss how to mount an Apple File System (APFS) partition on a Linux machine. This can come in handy in case we want to quickly access the data on an APFS partition.

Linux doesn’t have official support for the APFS filesystem. However, we can use helper libraries to access these partitions. Additionally, we should know that most of these utilities provide read-only access to the partitions.

We’ll cover the community-built apfs-fuse driver, which provides only read-only access to APFS paritions.

2. apfs-fuse

In the Linux world, FUSE or Filesystem in user space lets regular or non-privileged users create their own filesystem without modifying the system code. It provides a bridge to the actual kernel interfaces.

apfs-fuse works in the same way. However, it has shortcomings but is the only usable workaround available for Linux.

2.1. Installation

We’ll need to compile the driver from source. For that reason, we’ll need to download and install the dependencies first. So, let’s go ahead and install them using a package manager.

On Debian, Ubuntu, and Debian-based derivatives, we can use apt:

$ sudo apt install fuse libfuse3-dev bzip2 libbz2-dev cmake gcc-c++ git libattr1-dev zlib1g-dev

Similarly, we can use yum for Fedora and RHEL distributions:

$ sudo apt install fuse fuse3 bzip2 cmake gcc-c++ git libattr zlib

Next, let’s clone the repository into an empty directory:

$ git clone https://github.com/sgan81/apfs-fuse

Then, we initialize the submodule:

$ cd apfs-fuse && git submodule update --init

Now, we’re ready to compile the driver:

$ mkdir build && cd build && cmake .. && make

Alternatively, the driver is also available on the Fedora package repository under the canonical name apfs-fuse.

Once the driver is installed, let’s verify it:

$ whereis apfs-fuse
apfs-fuse: /usr/bin/apfs-fuse

2.2. Mounting APFS Drive

apfs-fuse follows the Linux convention for mounting and unmounting filesystems:

$ mount <DEVICE> <MOUNT_PATH>

With that in mind, let’s mount an APFS drive using the apfs-fuse helper:

$ apfs-fuse /dev/sdd1 /mnt/apfs-data

Similarly, we can specify the mount options using -o:

$ mount -o allowother /dev/sdd1 /mnt/apfs-data

2.3. Unmounting APFS Drive

In the same way, we can unmount the partition as root using umount:

$ umount /mnt/apfs-data

As a user, we can use the fusermount utility:

$ fusermount -u /mnt/apfs-data

3. Conclusion

In this article, we briefly discussed how we could mount and unmount an APFS volume on a Linux machine. For that purpose, we used the apfs-fuse driver to access APFS volumes in read-only mode.

Comments are closed on this article!