Bug 2432498

Summary: No support for APFS
Product: [Community] Virtualization Tools Reporter: Hamish McIntyre-Bhatty <redhat-bugzilla>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: mhicks, ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hamish McIntyre-Bhatty 2026-01-23 21:38:40 UTC
Description of problem:

APFS is not supported by libguestfs as of the last time I checked (unfortunately I don't know what version this was on). It would be useful to have it so it is easier to compact virtual machine images for macOS virtual machines on Intel Macs or Apple Silicon.

Version-Release number of selected component (if applicable):
Unknown as it was a while ago when I last tested it. Happy to re-test if it would be helpful.

How reproducible:
Reproducible every time.

Steps to Reproduce:
1. Create an APFS volume on a virtual disk managed by QEMU/KVM/libvirt.
2. Put some files on the volume.
3. Attempt to compact the volume with "virt-sparsify --compress" and find that it doesn't compress.

Actual results:
VM image is not compressed.

Expected results:
VM image is compressed by converting it into a sparse image.

Additional info:
N/A

Comment 1 Richard W.M. Jones 2026-01-26 18:56:18 UTC
I'm not at all familiar with APFS.  The only reference I can find is in util-linux.
A major problem seems to be that the kernel doesn't support it (unless it is
known by another name).

libguestfs uses Linux kernel and Linux userspace features, we don't implement filesystems
on our own.  If there is FUSE support we could use that (as we do for NTFS, sometimes).

Comment 2 Hamish McIntyre-Bhatty 2026-01-27 15:51:26 UTC
As far as I know there isn't support in the kernel, but there is a FUSE driver at https://github.com/sgan81/apfs-fuse

Comment 3 Richard W.M. Jones 2026-01-27 16:08:24 UTC
That's very encouraging, and also that it is packaged for Fedora and Debian.

I pushed this very minimal change which should allow mounting of APFS filesystems:

https://github.com/libguestfs/libguestfs/commit/8cd9adb2399513f3d49df6985c5657b78c9f916e

eg using:

./run guestfish -a apfs.img -m /dev/sda1 ll /

I couldn't actually *test* it because there seems to be no tool to make these
filesystems, and I don't have one around.

Also it would need enhancing to support other APFS features like encryption and
any other apfs* tools that we would like to use.

Comment 4 Hamish McIntyre-Bhatty 2026-01-30 15:10:45 UTC
Cheers, I shall test it when I have a little time.