5

I'm using an M3 silicon macbook running macOS 14.4 Sonoma.

I want to write files to an external USB hard drive formatted with an ext4 filesystem.

Related questions

  • This 2020 answer links to a solution that uses VirtualBox. But, VirtualBox doesn't work on 14.4; Also, in the comments users report that the linked VirtualBox setup instructions did not even work on earlier version. Comments also warn not to use the "Paragon" paid solution as this may result in data loss.
  • This 2022 answer ultimately links to macfuse, which gives your read but not write acess to ext4 drives.
  • I can corroborate this question, which notes that configuring QEMU by hand to reach the ext4 drive via a VM is… tricky. It's answer seems to say use macfuse, but I have only been able to get read-only mounts this way.
  • The 2022 answer to a similar question on the M1 platform has ext4fuse as a solution, but this only gives read access.
  • A decade ago, this answer says ext4fuse via homebrew (again the read-only solution for M3 in 2024). This 2016 answer confirms that ext4fuse does not have write support.
  • Inspired by This 2017 question I decided to put aside my concerns of data loss and try pairing the -o rw+ command line mount option with ext4fuse. But, as documented, ext4fuse does not support this option yet.

Where I've gotten so far:

  1. These steps worked for read-only access, for me.

  2. (Mac/osx/ext4)fuse-based solutions no longer work for M3 macs, and there's no stable solution on the horizon. Building something from scratch with unstable ext4 write support isn't in the cards, as I can't afford data loss.

  3. I opted to try to mount via a Linux virtual machine. I spent a day failing to manually get a linux VM running via QEMU (installed via homebrew). I gave up up and loaded up a Debian 12 VM via the UTM app.

This is where I'm stuck.

So, on an M3 mac I can't use (mac)fuse, or VM solutions that rely on VirtualBox. I can't find an up-to-date walkthrough doing this manually with qemu, but I can run UTM prebuilt Debian images.

Further research

  • I'm not sure what's going on in this thread, but maybe it's not possible to see USB devices in Linux VMs on M3 macs? The thread mentions terms I don't see in my own UTM interface so maybe it is outdated.
  • This page says "Only jailbroken or exploit-based installs of UTM support USB sharing. UTM SE does not support USB sharing." This implies I will not be able to see my ext4 USB drive from the Debian VM? But, it's not clear to me that I need this. The USB drive is evidently accessible, as ext4fuse can mount it read-only. Surely there is some way to mount it RW on the Debian VM without trying to get a jailbroken UTM install working?
  • This page seems to indicate USB sharing options used to be available in the UTM configuration dialog. These are absent in mine, presumably for reasons noted above.

Puzzling through

  • Returning to the comments section for the read-only macfuse tutorial, there is a small ray of hope in that some users report UTM Linux VMs being able to detect USB drives on M2 macs. But, this is not working for me presently.
  • diskutil list (I pulled diskutil from hombrew IIRC) confirms the drive is available as a device in macOS, at /dev/disk4on my system. So I have a device I can access, no rooting the macbook required. I just need to get this device file into /dev/ in the UTM Debian VM, but how?

I believe the next step is figuring out how to get /dev/disk4 on macOS mounted within the Debian VM in UTM. But, I'm at a loss as to how to do this. If it's not possible in UTM, then perhaps I need a more hand-holding walkthrough for getting a VM working in qemu directly?

5
  • 2
    Having said that: I found the tools in eclecticlight.co/downloads useful when running Linux VMs on Apple Silicon hardware. Not sure they help in your situation, I didn’t have the need to access external drives.
    – nohillside
    Commented Aug 5 at 15:59
  • @nohillside: For concreteness, I have a hard drive plugged into a StarTech drive bay, which connects to the laptop via USB. The drive is formatted in the ext4 format and I'd like to be able to save files on it from macOS.
    – MRule
    Commented Aug 5 at 16:26
  • The VM solutions only come into play because I cannot find native ext4 drivers for M3 macs. Native would be preferred. But, it seems like folks have been using the drivers inside Linux VMs as a workaround for quite some time.
    – MRule
    Commented Aug 5 at 16:53
  • 1
    This page says "Only jailbroken or exploit-based installs of UTM support USB sharing. - This refers to the iOS version of UTM only, otherwise known as UTM SE. USB sharing is most definitely supported in the desktop version. I currently have a ExFAT stick connected to a Debian 11 VM (QEMU 7.2 Arm) running on UTM 4.5.3. With some extra config I'd share it back to the Mac via SMB, if I needed to follow your approach of accessing ext4. Commented Aug 5 at 18:09
  • 3
    If this is something you expect to do regularly, your best option might be to add a Linux-based NAS to your network and connect the drive to its USB port. If you already happen to have such a device, that's certainly the way to go.
    – Linc Davis
    Commented Aug 5 at 21:07

1 Answer 1

3

This is a partial answer to help OP get their ext4 disk mounted on the VM. I'm stopping short of providing a detailed Samba config (OT for this site, and many good resources are available).

I've setup a pre-built Debian 12 (non-Rosetta, ARM on QEMU) VM on UTM 4.5.3. This particular one has been found to work (after offline discussion with OP) with the external USB device, as some of the other pre-builds have differences in original configuration that disallow access to the external USB device. A custom built VM from scratch can be setup with more expert knowledge if required.

No special configuration is needed to the VM to add the external disk. Although the documentation says to switch on USB sharing in the VM config (oddly in the Input section), I have found this pre-built VM does not have it switched on, but this has no negative effect and the procedure outlined below works regardless. For example, I see this dialog for this input section:

enter image description here

Once the VM is started plug in your ext4 USB device. You will be presented with possibly a couple of dialogs. The first is from macOS as it does not recognise the ext4 partition. Select Ignore.

Dialogs presented on device plugin

You may see the second dialog which is UTM requesting whether you want to attach the device to the VM. Select Confirm.

If you don't see this second dialog you can manually connect the device to the VM by pressing a USB plug-shaped button at the top right of the VM.

Manual USB device connection

Select the device, and select Allow in the next dialog. The Debian VM will auto mount the device (Linux auto mounting processes are off-topic for this answer) into /media/debian/<<UUID>>. It will also be present in the Files app (this VM is a Gnome build).

debian@debian:~$ mount
.
.
/dev/sda on /media/debian/4d6487cb-5523-4bbf-919f-4c68d9f54fce type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)

To provide access back to the macOS host, you can setup Samba access.

UTM also has provision for sharing folders with hosts, but that is a host folder shared with the VM only, not the other way round. That involves installing extra device drivers into the VM (might already be in this pre-build, but I've not explored).

https://docs.getutm.app/guest-support/sharing/directory/

This could be a quick solution if this copy is a one-off, or otherwise a low impact. Share your macOS source folder into the VM, then do the copy to your external disk in the Linux VM file manager (or command line) rather than drive it from the macOS side. This saves getting into a complicated Samba setup. sftp would also be another option.

As mentioned in the comments, a Linux based NAS is a solid alternative for a more long-term solution. Even something as small as a Raspberry Pi 4 can be utilised (what I use), but ensure your external disk is powered, either by it's own supply or a powered USB3 hub, as the RPi4 can't reliably power spinning disks even though it's a vast improvement on the capability of previous models.

(Copied from comments) - This page says "Only jailbroken or exploit-based installs of UTM support USB sharing. - This refers to the iOS version of UTM only, otherwise known as UTM SE. USB sharing is most definitely supported in the desktop version.

2
  • This is the way. If the OP can’t use any other disk format, bringing software that’s best suited to this task in late 2024 is a VM.
    – bmike
    Commented Aug 6 at 13:56
  • 1
    Using the Debian 12 as opposed to the Debian 12 Rosetta UTM image is the key here. Also, getting samba setup was a chore, but it all works.
    – MRule
    Commented Aug 6 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .