lawik

lawik

Nerves Core Team

Unexpected behaviour with :disksup.get_disk_info

I am probably holding a piece of Erlang wrong but this was unexpected.

Any clues?

First 7 of 7 Posts Switch mode

hubertlepicki

hubertlepicki

What if you add slash at the end, i.e. /root/ ?

D4no0

D4no0

Mine works, but I had to do :disksup.start_link before using it as I got the warning:

12:42:54.797 [warning] OS_MON (:disksup) called by pid<0.110.0>, not started

hubertlepicki

hubertlepicki

iex(8)> :disksup.get_disk_info()
[
  {~c"/", 488878112, 358518096, 23},
  {~c"/dev", 4096, 4096, 0},
  {~c"/dev/shm", 16388668, 16193968, 2},
  {~c"/sys/firmware/efi/efivars", 128, 97, 22},
  {~c"/run", 6555468, 6553344, 1},
  {~c"/tmp", 16388672, 16303136, 1},
  {~c"/boot", 1684592, 1242612, 22},
  {~c"/boot/efi", 523248, 482132, 8},
  {~c"/run/user/1000", 3277732, 3277576, 1}
]
iex(9)> :disksup.get_disk_info(~c"/")
[{~c"/", 488878112, 358518060, 23}]
iex(10)> :disksup.get_disk_info(~c"/run/user/100")
[{~c"/run/user/100", 0, 0, 0}]
iex(11)> :disksup.get_disk_info(~c"/run/user/100/")
[{~c"/run/user/100/", 0, 0, 0}]

Mine does not, with slash or not at the end.

D4no0

D4no0

Hmmm, what the. Can you try starting iex as root?

hubertlepicki

hubertlepicki

no, can’t now actually. But it works for some mount points, not for the others. I could get the stats for /boot for example.

D4no0

D4no0

You actually have a typo:

Should be ~c"/run/user/1000". This is expected behavior as specified per documentation:

Returns [{Path,0,0,0}] if the Path is invalid or space can’t be determined. Returns [{“none”,0,0,0}] if disksup is not available.

hubertlepicki

hubertlepicki

lmao okay you’re right, I brought nothing to the conversation

— All posts loaded —

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement