Skip to content

[Request]: Guest agent API call for returning freed disk blocks to macOS. #542

@jglogan

Description

@jglogan

Feature or enhancement request details

The virtioblk device and the hypervisor are capable of returning trimmed/discarded blocks back to the host, but at present the guest agent does not issue FITRIM for read-write filesystems, so regardless of what is removed in the guest, the host block file will only grow in size as reported by ls -ls or du -s.

The enhancement should allow freed disk blocks to be returned to macOS.

Please do not just yolo a PR for this. Let's settle on the requirements and API design here in the issue first, and from there the PR should not be too difficult.

At the very least the API should allow implementation of a container command such as (the verb is a placeholder, we can come up with something more succinct):

container reclaim-disk-blocks [mount-path...]

where if no mount paths are specified, the command initiates reclamation on all read-write mounts for the running container.

I'll paste a pseudocode implementation of the reclamation mechanism in the discussion.

Open issues:

  • API name?
  • Reclamation policy? One or more of (we should start simple but the policy API should follow open-closed principle):
    • One time request from caller (we could defer all other policy, except continuous, to the caller, though threshold based would require the caller to be able to monitor utilization on filesystems)
    • Periodic
    • Threshold based
    • Continuous
    • Other?
  • One filesystem per request, or multiple?

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions