Mounting APFS Partition on Linux
Original Version: https://www.baeldung.com/linux/apfs-partition-mount
apfs-fuse
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 g++ git libattr1-dev zlib1g-dev
Similarly, we can use yum for Fedora and RHEL distributions:
$ sudo apt install fuse fuse3 bzip2 cmake gcc g++ 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
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
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