systeminformation icon indicating copy to clipboard operation
systeminformation copied to clipboard

statvfs

Open ronag opened this issue 3 years ago • 7 comments

I'm looking for something similar to statvfs (that can e.g. be accesses through https://www.npmjs.com/package/diskusage). However, I would like to be able to run it from a worker (i.e. no native addons).

ronag avatar May 17 '21 05:05 ronag

@ronag I actually do not understand your question/request ... can you be more precise on what you would expect?

Is it something like networkStats(), fsStats(), disksIO() in my package? What is missing?

sebhildebrandt avatar May 17 '21 06:05 sebhildebrandt

Is it something like networkStats(), fsStats(), disksIO() in my package? What is missing?

Something like fsSize(). However, fsSize() does not include docker mounted volumes. I basically want something like:

const disk = require('diskusage')
const { total, available } = await disk.check(dirPath)

The problem I have with the diskusage package is:

  • It doesn't work in Worker threads.
  • It is not systeminformation package.

ronag avatar May 17 '21 06:05 ronag

@ronag Ok, understand partially ;-) Can you give me an example ... so what exactly you mean with docker mounted volumes ... so inside docker or what? Would be great if you can describe your use case a little bit. Then I can really understand the problem.

Is it more like statvfs where you just want to retrieve free disk space (so more like what I have in si.fsSize()? Can you provide also examples (maybe with output of df which volumes are not shown?

sebhildebrandt avatar May 17 '21 06:05 sebhildebrandt

Is it more like statvfs

It is exactly like statvfs.

maybe with output of df which volumes are not shown?

The "mounted" volumes are not shown in df. I think docker doesn't actually mount it as a "volume" but just "symlinks" the directory to the docker volume.

ronag avatar May 17 '21 06:05 ronag

@ronag I still don't get what you are really looking for. Can you please describe your use case? I still don't know if you are trying to controll something INSIDE of a docker container or from OUTSIDE. Please describe the full story. Then I could think of how to implement something ...

sebhildebrandt avatar May 17 '21 06:05 sebhildebrandt

Inside a docker container I want to find out how much free and total space the drive of a specific path has. The path has been linked to docker volume (-v /volumes/media:/volumes/media).

ronag avatar May 17 '21 07:05 ronag

@ronag OK, I guess I understand ... so this is not trivial. There are attempts to get fs.statfs() into node.js but this is still an unresolved issue (v16 still does not support it). Need to think if I can find a solution.

sebhildebrandt avatar May 17 '21 07:05 sebhildebrandt