ext4

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:

HTGWA: Partition, format, and mount a large disk in Linux with parted

This is a simple guide, part of a series I'll call 'How-To Guide Without Ads'. In it, I'm going to document how I partition, format, and mount a large disk (2TB+) in Linux with parted.

Note that newer fdisk versions may work better with giant drives... but since I'm now used to parted I'm sticking with it for the foreseeable future.

List all available drives

$ sudo parted -l
...
Error: /dev/sda: unrecognised disk label
Model: ATA Samsung SSD 870 (scsi)                                         
Disk /dev/sda: 8002GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Good, I had plugged in that SSD just now, and it's brand new, so it doesn't have a partition table, label, or anything. It's the one I want to operate on. It's located at /dev/sda. I could also find that info with lsblk.

Mounting a Raspberry Pi's ext4 SD card on Ubuntu 14.04 inside VirtualBox on Mac OS X

Since I'm running a Mac, and don't have a spare linux-running machine that can mount ext4-formatted partitions (like those used by default for official Raspberry Pi distributions like Raspbian on SD cards), I don't have a simple way to mount the boot partition on my Mac to tweak files on the Pi; this is a necessity if, for example, you break some critical configuration and the Pi no longer boots cleanly.

To mount an ext4-formatted SD or microSD card on a Mac, the easiest option is to use VirtualBox (and, in my case, Vagrant with one of Midwestern Mac's Ubuntu boxes). Boot a new linux VM (any kind will do, as long as it's modern enough to support ext4), shut it down, go into Settings for the VM inside VirtualBox and enable USB, then reboot.

Follow these steps once the VM is booted, to mount the flash drive: