Mounting an APFS external hard drive

Posted

An external hard drive that I had been using on Mac OS for years is using the APFS file system. Don’t ask me why.

Plugging in the drive showed that the system and file manager couldn’t deal with apfs.

I’m mainly wanted to view the files. A quick google and I came across a forum posts suggesting to use apfs-fuse:
  • https://forums.raspberrypi.com/viewtopic.php?t=251476
  • apfs-fuse: https://github.com/sgan81/apfs-fuse

There steps to download and compile worked for me, with one exception. I guess gcc-c++ is no longer the package name in Linux

Downloaded the necessary tools:

sudo apt update
sudo apt install fuse libfuse3-dev bzip2 libbz2-dev cmake git libattr1-dev zlib1g-dev

Then close the github locally:

git clone https://github.com/sgan81/apfs-fuse.git
cd apfs-fuse
git submodule init
git submodule update

And compile:

mkdir build
cd build
cmake ..
ccmake . # Only if you want to change build options
make

The last issue I ran into was actually mounting the hard drive. I asked for a little help from ChatGPT, which suggested:

sudo ./apfs-fuse -o allow_other /dev/sda2 /mnt/apfs

I was having permissions issues viewing before using the -o allow_other, and the ./ is because apfs-fuse was compiled locally, and doesn’t have any symbolic link for the system to know where to search for it.

I don’t think this will be automated, so I’ll have to manually mount APFS drives for now, but I was able to view the drive and files after following the above steps.

Author