macOS: mount any linux-supported filesystem read/write using NFS and a microVM
macOS: mount any linux-supported filesystem read/write using NFS and a microVM
Full read-write access to ext4, btrfs, or any other Linux-supported filesystem on a Mac. Based on the libkrun microVM hypervisor and NFS — no kernel extensions, no lowering system security.
brew tap nohajc/anylinuxfs
brew trust nohajc/anylinuxfs
brew install anylinuxfs
[!TIP] This is a CLI utility. If you prefer GUI, see anylinuxfs-gui.
anylinuxfs supports toontfs-3g driver which misbehaves in combination with NFS (used for exposing the files to macOS). Instead, you can use ntfs3 driver which doesn't have this issue. If you're wondering why that one is not the default, it's explained in NTFS notes below. There's hope the situation might improve once yet another new NTFS driver lands in Linux kernel.[!CAUTION] Before using anylinuxfs with NTFS, please read the notes
https://github.com/user-attachments/assets/6ec6ce46-ce08-45b9-9fa4-e3d6d078d811
Mounting 3rd-party filesystems on macOS has always been tricky. There's official support for reading NTFS but otherwise we've mainly used solutions based on macFUSE. We've got NTFS-3g which is a pretty mature driver but for Linux filesystems there's only a couple of experimental solutions like fuse-ext2 or ext4fuse.
If you want a reliable solution with full write access, you need to run a Linux virtual machine with physical disk access and take care of exposing the mounted filesystem to the host.
This is exactly what anylinuxfs does and it streamlines it so that it's as easy as running one command in terminal.
You pick a drive, mount it with anylinuxfs and it appears as a NFS share on localhost. This spins up a microVM in the background which uses the real linux drivers, so you can access anything from ext* to btrfs. Any mount options on the command-line will be forwarded to the linux mount command, so you can mount read-only, read-write, pick btrfs subvolumes, etc. Then you simply eject the drive in Finder or use anylinuxfs unmount in terminal and the virtual machine will be turned off.
This all sounds like a lot of work but it's actually very fast. Not like a traditional virtual machine which takes a while to boot. This one is just a stripped down version of Linux, there's not even a UEFI firmware. Practically, it takes only a couple of seconds before the drive is mounted and ready to use.
Most often, you will probably use the following commands:
anylinuxfs mount - mount a filesystem; this is the default command, so the mount keyword can be omittedanylinuxfs unmount - safe unmount, useful in case of multiple mounts (typically ZFS datasets) which need to be ejected in a particular orderanylinuxfs list - show available filesystems (-m/-l shows Microsoft/Linux partitions only)anylinuxfs status - show what is currently mountedanylinuxfs log - show details about the current (or last) run, useful for troubleshootinganylinuxfs vm - open a shell or run a command inside the VM used for an active filesystem mountFrom anylinuxfs mount --help:
…
/dev/diskXsY - based on how anylinuxfs list or diskutil list identifies your drives.lvm or raid (for mdadm Linux RAID).
These can be deduced from anylinuxfs list output where any logical volumes will be shown as synthesized disks (similar to how diskutil does it for APFS containers)anylinuxfs list output./dev/diskXsY:/dev/diskYsZ syntax. Basically, you must specify all partitions that need to be attached to our microVM so that they can be scanned for any multi-disk btrfs filesystems.file.img@s1 or image.qcow2@s1).Logo designed by Junaid Iqbal.
This project was made possible by
Thank you all for your great work!
Request: compile ecryptfs kernel module and add SMB first-class support
Suggestion: Using Apple Containers Instead of Docker for the NFS Launcher
Support for Partclone images
Support for Time Machine
Cant open luks Encrypted drives
Idea: dedicated commands optimized for file transfer
Support for mounting bitlocker encrypted VHDX file
Please add the NTFSPLUS linux driver
Feature request: automount volumes
anynetbsdfs