goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.79k stars 4.73k forks source link

Garbage Collection in Harbor Not Freeing Up Expected Storage Space While the UI Shows Space Has Been Freed Up #20894

Open ElieAzar-Algo opened 3 weeks ago

ElieAzar-Algo commented 3 weeks ago

Expected behavior and actual behavior:

I encountered a problem with the cleanup of unused Docker images due to full storage on my server.

Expected Behavior:

The mounted storage pointing to the Docker Images directory is full:

Filesystem Size Used Avail Use% Mounted on
/dev/sdb 197G 197G 0G 100% /Docker_Images

To free up space, I applied the following retention policy to the project with approximately 125GB of images:

After running the retention policy, I observed the following result in the UI: image

Next, I went to the "Clean Up" section, ran the Garbage Collection, and received this output:

The expected result was for the images to be cleaned up and the storage to reflect something around the following:

Filesystem Size Used Avail Use% Mounted on
/dev/sdb 197G 77G 120G 39% /Docker_Images

Actual Behavior:

However, the actual result is that the Garbage Collection only freed up about 10GB of space, despite the UI indicating that 15710 blob(s) and 5974 manifest(s) were deleted, freeing up 120.57GiB, as shown in the screenshot above.

Steps to reproduce the problem:

  1. Confirm that the storage mounted on the server for Docker images is full:

    • Example:

      Filesystem Size Used Avail Use% Mounted on
      /dev/sdb 197G 197G 0G 100% /Docker_Images

  2. Go to the project in Harbor with the highest size of Docker images.

  3. Apply the following retention policy:

    • For repositories matching **, retain the most recently pushed 5 artifacts with tags matching **, and include untagged artifacts.
  4. Run the retention policy and observe the result in the UI. as shown above in the screenshot that everything is going as expected

  5. Go to the "Clean Up" section and run the Garbage Collection with the following settings:

    • Mode: Manual
    • Dry Run: No
  6. Note the output that shows the following:

    • Result: SUCCESS
    • Details: 15710 blob(s) and 5974 manifest(s) deleted, (ex: 120.00GiB) space freed up as shown above in the screenshot
  7. Check the server storage again using the df -h command:

Versions:

Please specify the versions of following systems.

Additional context:

Harbor config files:

wy65701436 commented 2 weeks ago

can you try to restart harbor? and then check the storage again.

ElieAzar-Algo commented 2 weeks ago

Thank you, @wy65701436, for your response.

I restarted Harbor, but the storage issue persists. In fact, we've done multiple restarts over the past few days without any improvement.