Why longhorn volume still shows more space than the actual size after deleting the content?

This document (000020027) is provided subject to the disclaimer at the end of this document.

Situation

Question

Why does Longhorn report higher Actual Size for a volume than the usage reported by the filesystem, even after deleting content?

Pre-requisites

  • A Kubernetes cluster with Longhorn installed
  • An existing workload using a Persistent Volume (PV) of the Longhorn StorageClass (SC)

Answer

Whilst Longhorn storage is thin-provisioned, a volume cannot shrink in size after content is removed.

Per the Longhorn Documentation: "This happens because Longhorn operates on the block level, not the filesystem level, so Longhorn doesn’t know if the content has been removed by a user or not. That information is mostly kept at the filesystem level."

You can demonstrate this behaviour, by attaching a 10GB Longhorn volume to a Pod, creating 6GB of files on the volume and then deleting 4GB, as follows:

  1. Increase the disk usage of the volume:

    dd if=/dev/zero of=4gbfile bs=4G count=1
    dd if=/dev/zero of=2gbfile bs=2G count=1
  2. Remove the 4gbfile from the mounted volume:

    rm 4gbfile
  3. Check the usage reported by the filesystem, by running du -sh on the mounted volume, which will show 2GB.

  4. Navigate to the Longhorn UI and check the Actual Size, reported under Volume Details in the Volume view, which will show 6GB of usage still.

Further Reading

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020027
  • Creation Date: 06-May-2021
  • Modified Date:06-May-2021
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback@suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center