Mount a Raspberry Pi SD card on a Mac (read-only) with osxfuse and ext4fuse

So you're telling me I can read files from a Raspberry Pi microSD card?

For my Raspberry Pi Time-Lapse App, I find myself having to either copy hundreds (or thousands!) of 3+ MB image files, or a 1-2 GB video file from a Raspberry Pi Zero W to my Mac.

Copying over the WiFi network works, but it's extremely slow (usually topping out around 5 Mbps... which means it could take a couple hours to copy). So I decided to finally try to mount the Raspberry Pi's drive directly on my MacBook Pro (running macOS Sierra 10.12). This is normally a bit tricky, because the Raspberry Pi uses the Linux ext4 filesystem—which is not compatible with either macOS or Windows!

In the past, I would use the dd utility to back up the entire card, and then I would mount that backup disk image and read data off of it. But this is annoying, because dd will back up the entire microSD card, not just the data I want. So it takes a really long time.

Luckily, there are open source tools that allow ext4 filesystems to be mounted on a Mac (read-only, but that's all I need to copy off the time-lapse stills and video).

Here's how to mount the Raspberry Pi's ext4 filesystem on a Mac (almost everything will be done in the Terminal app (in Applications > Utilities)):

  1. Plug the microSD card into a card reader connected to your Mac. The boot volume will be automatically mounted, but it doesn't contain all the files from the Pi's primary filesystem.
  2. Make sure you have Homebrew installed (instructions here), so you can install the tools you need to mount the filesystem.
  3. Using Homebrew, install osxfuse and ext4fuse (find out more about the tools on the FUSE for macOS website):
    1. brew install macfuse
    2. brew install ext4fuse (Note: This seems to not work as of late 2021; see this issue).
  4. Use Disk Utility on the command line to find the Raspberry Pi's partition ID; run diskutil list to get output like below:

    $ diskutil list
    /dev/disk0 (internal):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                         500.3 GB   disk0
       1:                        EFI EFI                     314.6 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            499.3 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    
    /dev/disk2 (external, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *32.0 GB    disk4
       1:             Windows_FAT_32 boot                    66.1 MB    disk4s1
       2:                      Linux                         31.9 GB    disk4s2
    

    You should be able to tell which drive is your Pi drive by the description (external, physical), the 'Linux' partition type, and the size of the disk (e.g. 31.9 GB for my 32 GB card). The ID is the disk4s2 in my case, in the IDENTIFIER column.

  5. Create a 'mount point'—a folder on your Mac where you will 'mount' the Linux partition so you can read data from it: sudo mkdir /Volumes/rpi (sudo requires you to enter your Mac account's admin password, since it performs actions with elevated privileges—enter your password when prompted.)

  6. Mount the drive using ext4fuse: sudo ext4fuse /dev/disk4s2 /Volumes/rpi -o allow_other

The -o allow_other is required to make sure the mounted disk is readable by everyone (and not just the sudo/root user). See this issue: Unable to open ext4 mounted partition on El Captain.

Now you'll see the rpi volume mounted in the Finder. You can open it and read from it just like any other disk, card, or flash drive you connect to your Mac.

Once you're finished, make sure you safely unmount the disk, by either ejecting the disk in the finder, or running sudo umount /Volumes/rpi in Terminal. After that, you can unplug the card and put it back in your Pi, where it will be ready to do more awesome Pi things!

Comments

Nice reference.

To other readers, whatever you do, do not install the experimental (!) write EXT4 support on macOS. You *will* corrupt your card. Don't ask me how I know.

Thanks for the wonderful instructions, I used it to eliminate the annoying sequence you also suffer from when imaging SD cards. This will come in handy for flashing the Piper computer card.

For some reason I'm getting Partition doesn't contain EXT4 filesystem with a raspberry pi SD. Any ideas?

I really thank you !
I don't know why but I couldn't mount ext4 partitions with my Windows's PC using software.
It's the only source I found about it.

I'd consider adding the "defer_permissions" flag too - it helped me solve the issue of not having the required permissions to read the data when attempting to copy files (even though I could read them...just not copy them). Go figure!

You can mount the SD card on macOS with r/w support using

https://github.com/alperakcan/fuse-ext2

The readme in the repo has instructions on how to get everything going. ? Also provides additional utilities for working with ext{2,34} file systems. One of the current caveats is that using rsync to write to a ext* fs won't go much faster than ~ 5MB/s from my experience.

That said, for enabling ssh on a Raspi when you have no usb mouse or keyboard, and you're in a pinch it comes in quite handy to be able to write files.

I have a collection of notes about working with ext* filesystems on macOS below,

https://github.com/ipatch/dotfiles/wiki/linux-macos-administration-Note…

cheers ?

You just saved me several hours of work!! Thank you so much for this!

Thank you, I could get to my openhab config files on the SD card, saved me hours of work!

Very nice and clear instructions, my now I should reinstall HA and import old configurations.

This worked without issues a few months ago: now it tells me the resource a busy when trying to mount it? (just upgraded to Mojave which might be the problem). Does anyone know a solution to the issue? I can't find the same one online.

/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *63.9 GB disk4
1: Windows_FAT_16 RECOVERY 1.3 GB disk4s1
2: Linux 33.6 MB disk4s5
3: Windows_FAT_32 boot 69.2 MB disk4s6
4: Windows_FAT_32 NO NAME 62.5 GB disk4s7

Catharinas-MacBook-Pro:~ catharinagallacher$ sudo ext4fuse /dev/disk4s7 /Volumes/rpi -o allow_other
disk_open: /dev/disk4s7: Resource busy

I'm running Mojave and I'm getting the error:
Partition doesn't contain EXT4 filesystem

When trying to mount the drive I am getting the following:
'MyMacPro-2:~ hermar$ ext4fuse: sudo ext4fuse /dev/disk6s2 /Volumes/rpi -o allow_other
-bash: ext4fuse:: command not found

Any idea how to resolve this?
many thanks.

The command in your case is actually:

sudo ext4fuse /dev/disk6s2 /Volumes/rpi -o allow_other

You don't need the initial "ext4fuse:" on your command. The text markdown in this article made it look like that was part of the command, but it's not.

Eveything has worked up until the end. I don't seem to see rpi mounted in my finder. When I try to mount it again i get this message: "mount_osxfuse: mount point /Volumes/rpi is itself on a OSXFUSE volume" Why isnt it showing up in my finder?

Hi, I had the same issue myself. Open finder, then use 'Go to Folder' under the 'GO' dropdown in the tool bar. Type in /Volumes/rpi.