Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data and root partition full warning / notification. #1234

Open
mpvader opened this issue Mar 3, 2024 · 10 comments
Open

Add data and root partition full warning / notification. #1234

mpvader opened this issue Mar 3, 2024 · 10 comments
Assignees
Milestone

Comments

@mpvader
Copy link
Contributor

mpvader commented Mar 3, 2024

Relates mostly to people using large image. The full data partition is most valuable, since that affects our main use case (node-red); and full root partition is for all the tinkerers and people with mods.

(note that I'm only 99% sure that a full root partition is not normal - Jeroen will know for sure).

some data from the system that got me here:

root@einstein:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root               972392    927788         0 100% /
devtmpfs                465376         4    465372   0% /dev
tmpfs                   515040      1016    514024   0% /run
tmpfs                   515040       576    514464   0% /var/volatile
/dev/mmcblk1p5         1134336   1059272         0 100% /data
/dev/mmcblk0p1        15538856      1280  15537576   0% /run/media/mmcblk0p1
tmpfs                   515040      1016    514024   0% /service
overlay                 515040       576    514464   0% /var/lib
root@einstein:~# cd /data
root@einstein:/data# ls
123SmartBMS-Venus     VeCanSetup            etc                   log                   reinstallScriptsList  var
GuiMods               conf                  home                  lost+found            setupOptions          venus
SetupHelper           db                    keys                  rcS.local             themes                vrmfilescache
root@einstein:/data# du -d 3 /data | sort -nr
1055788	/data
1039424	/data/conf
1039320	/data/conf/signalk
71048	/data/conf/signalk/node_modules
64224	/data/conf/signalk/.npm
7188	/data/conf/signalk/.cache
7032	/data/GuiMods
6348	/data/log
6208	/data/GuiMods/FileSets
1700	/data/GuiMods/FileSets/v3.20~36
@kwindrem

This comment was marked as resolved.

@mpvader

This comment was marked as resolved.

@pkkrusty

This comment was marked as resolved.

@mpvader mpvader added this to the v3.40 milestone Apr 18, 2024
@mpvader

This comment was marked as resolved.

@mpvader

This comment was marked as resolved.

@pkkrusty

This comment was marked as resolved.

@mpvader

This comment was marked as resolved.

@mpvader
Copy link
Contributor Author

mpvader commented Jun 14, 2024

hey @mansr , as discussed - any preference on what system calls to use to check for free disk space?

Do we need to try write a file? Or can some simple standard call checking for free diskspace be used?

@kwindrem
Copy link
Collaborator

I use

availableSpace=$(df -m / | tail -1 | awk '{print $4}')
to check fullness in SetupHelper. -m returns available space in megabytes.

This is called from a shell script but could also be done via a procedure call in python.

@mansr
Copy link
Collaborator

mansr commented Jun 19, 2024

I would suggest checking both free space (blocks) and free inodes (files). In a shell script, stat -f will print these values. From C or C++, use the statvfs system call, also available in Python as os.statvfs. What thresholds to use for a warning will need some consideration. If we want to get fancy, we could even warn if the rate of change over an hour (or maybe day) is too high. That might alert the user to take action before it becomes urgent.

@mpvader mpvader modified the milestones: v3.40, v3.30, v3.50 Jul 2, 2024
@mpvader mpvader modified the milestones: v3.50, v3.60 Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants