Mounting an ext4 linux USB drive on macOS in 2024

I recently pulled a SATA hard drive out of a Linux box that I wanted to grab some files off of. I only had my Mac on hand, and I had a USB 3.0 to SATA hard drive adapter at the ready.

But when I plugged in the hard drive, macOS said it couldn't recognize the disk.

Disk unreadable by macOS

Makes sense, because macOS includes support for Apple's filesystems, not Linux (or even NTFS, Windows' preferred filesystem). There are commercial solutions you can buy, like Paragon Software's extFS for Mac, but that costs $39, and I don't want to deal with the licensing issues that may exist there if I just want to grab a few files off one hard drive.

Luckily, there are some open source libraries that allow at least read only access to ext4-formatted disks on macOS. Let's install them and use them to mount the drive:

First, install macfuse, using homebrew:

brew install --cask macfuse

This will likely ask you for your sudo password, as it needs to install a kernel extension.

After that's done, you'll need to manually clone and compile ext4fuse:

git clone https://github.com/gerard/ext4fuse.git && cd "$(basename "$_" .git)"
make

Then create a mount point and mount your external hard drive. If you don't know which drive is the external drive, use diskutil list and figure out which one it is—in my case it was /dev/disk5 (external, physical):

$ diskutil list 
/dev/disk5 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *20.0 TB    disk5
   1:       Microsoft Basic Data                         20.0 TB    disk5s1

Next, create a mount point for the disk, and then attempt mounting it there:

mkdir ~/ext4_mount
sudo ./ext4fuse /dev/disk5s1 ~/ext4_mount -o allow_other

This will pop a couple warnings like "System Extension Blocked":

System Extension Blocked dialog

Click 'Open System Preferences', then click 'Allow' where it asks if you want to allow the system extension to run:

Allow system extension in system preferences settings macOS

This will prompt you to reboot the computer — that now, and once you're back up and running, try mounting the disk again:

sudo ./ext4fuse /dev/disk5s1 ~/ext4_mount -o allow_other

This should work, and you'll see a new disk mounted, like "macFUSE Volume 0 (ext4fuse)". Open that up, and browse around, and you should be able to read the contents of the disk now.

When you're finished, run:

sudo umount ~/ext4_mount

And unmount the disk.

Unfortunately, this doesn't seem to work with every partition I've thrown at it. Sometimes it works, sometimes it shows up as an empty volume... not sure why.

The better option would be to have a separate Linux computer (even a little Raspberry Pi!)—plug the drive in there, then if you need the files on your Mac, create a Samba share and access the files over your network.

Comments

Heh. I'm guessing you mean Asahi, and that's an option (though a few more steps!); and I used to use VirtualBox to do this in the old days, but as it's not easy to get that working on M1/M2/M3 Apple Silicon Macs, and Docker support for hardware device passthrough doesn't work the same under Docker Desktop for Mac, this is the easiest way short of buying the commercial product :(

I can also recommend UTM for Apple Silicon Macs. It's not nearly as fast as Parallels, but it's more than good enough for what you were trying to do here Jeff. It ran fine on my M1 mini and M1 MBA under Ventura.

I would like to believe that page is out of date since I have used my barebones Ubuntu VM to look around EXT4 drives a few times. As long as your vm is running over QEMU, UTM detects off you plug in a new device and asks if you would like to pass it to your vm.

It works ok-ish for hard drives, but dealing with sd cards with ext4 on them on macos silicon is just pain.
for linux vms you need external sdcard reader (internal is not recognised as usb device), and even then performance is sub-par.

I use Parallels Desktop for it, not only ext4, but also other FS

There’s FUSE-T (fuse-t.org) which doesn’t require a kext or reboot and also works on newer ARM Macs. It creates an NFS server in the background and mounts that using macOS’ native NFS support.

See https://github.com/macos-fuse-t for the different filesystem plugins already made to work with FUSE-T. For others, you usually can just replace “fuse” with “fuse-t” and recompile. Or do some library loading trickery if you only have the binary.

The last time I used osx was around 2010, but whenever I needed to transfer files from or to Linux & osx, I used to just set up a python ftp server on the machine that had the files. Maybe not the best solution, but it worked....

One of the silliest things I've learned is: 7zip can understand EXT4. Not perfectly, but if all you need to do is slurp files out of (or add a few files to) an EXT4 filesystem, you can do that with 7zip, at least on windows.

Unfortunately as well, the macfuse project is running into more and more barriers, what with kexts being slowly removed, Mac-fuse-t looks to be a good alternative -- it behaves just like fuse but exposes an NFS interface, rather than a native filesystem.

Macfuse has never seemed to work for me on my M1 Air, but the macos-fuse-t suggested by other commenters did. I did `brew install macos-fuse-t/homebrew-cask/fuse-t` and `git clone https://github.com/macos-fuse-t/ext4fuse.git && cd "$(basename "$_" .git)"` instead of the first two commands.

ext4fuse might be open source but unfortunately macfuse is not.