Skip to content

Conversation

wildmer
Copy link

@wildmer wildmer commented Feb 15, 2025

Disk statistics were not working correctly on my device. After investigating the issue, I noticed that /data was missing from the list of mount points. However, there was a match with /product/data-app, which likely caused the error.

Example output from the df -h command:

  overlay                             12K  12K     0 100%  /product/data-app
  /dev/fuse                          475G 138G  337G  30%  /storage/emulated

To fix this, I modified the mount point detection logic for /data, ensuring that any incorrect matches with overlay are excluded and setting a default value if /data is not found.

Code Changes:

  dir=$(df -h | grep '/data' | grep -v 'overlay' | awk '{print $6}')

  if [ -z "$dir" ]; then
      dir="storage/emulated"
  fi
  _MOUNTED_ON="$dir"

With this change, /data mount point detection is more accurate and should prevent issues on devices where /data does not appear directly in the df -h output. This could solve the issue #76

Attached is a screenshot showing the detected issue:
Screenshot_2025-02-14-22-03-19-549_com termux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant