VZStorageDeviceAttachment compression

I was wondering if there is any possibility to somehow implement compression of VZStorageDeviceAttachment like VZDiskImageStorageDeviceAttachment used for the VZVirtioBlockDeviceConfiguration. I know that APFS is doing some work here, but I would also wanto to be able to store attachments on other filesystems and still keep them use only the space required. From what I searched there is no other attachment that can be used instead, but maybe there are some clever tricks that could be done to achieve this? I don't think its possible to write own implementation of VZStorageDeviceAttachment correct?

Post not yet marked as solved Up vote post of Damian Dudycz Down vote post of Damian Dudycz
1.1k views

Replies

I don't think its possible to write own implementation of VZStorageDeviceAttachment correct?

That is right. The VZStorageDeviceAttachment represent the attachment while the actual implementation of the disk access is done in the Virtual Machine service.

there are some clever tricks that could be done to achieve this?

The support of VZDiskImageStorageDeviceAttachment expects a regular file and use normal VFS system calls to interact with it.

The fact that it can remain sparse relies on the F_PUNCHHOLE fcntl of macOS. The compression is an optional property of APFS that is transparent from the user space. It might be possible to write a KEXT to expose a virtual filesystem with those properties but it's probably not worth it.