disksup(3)

πŸ“¦
version 29.0.6 Β· 2 versions
, in nixos 26.05, nixpkgs unstable, ubuntu stonking

πŸ’Ύ disksup β€” bestie's guide to the disk space supervisor πŸ’–

okay so this is disksup, and it lives in the os_mon application (go read os_mon(6) if you haven't, iykyk). she's the one who watches your disks. on Unix AND on Windows. equal opportunity disk-watcher. πŸ’…


✨ NAME ✨

disksup β€” A Disk Supervisor Process πŸ‘‘


🌸 DESCRIPTION 🌸

disksup is literally a process that supervises the available disk space in your system. she's part of the OS_Mon application β€” see os_mon(6). available for Unix and Windows. no cap.

she checks the disks periodically, on a lil schedule. and for each disk or partition that's using more than a certain amount of the available space, the alarm

{{disk_almost_full, MountedOn}, []}

gets set. like, she's not gonna let your disk fill up in silence, she's gonna tell somebody. πŸ“£

πŸ–₯️ On Unix

All (locally) mounted disks get checked, and yes bestie, that includes the swap disk if it's present.

πŸͺŸ On WIN32

All logical drives of type "FIXED_DISK" get checked. that's the vibe check she runs.


Alarms get reported to the SASL alarm handler β€” see alarm_handler. to set an alarm, alarm_handler:set_alarm(Alarm) is called, where Alarm is the alarm specified up above. πŸ‘†

and the alarms get cleared automatically when the alarm cause is no longer valid. she's not dramatic, she moves on. 🧚

βš™οΈ Configuration

these configuration parameters can be used to change the default values for the time interval and the threshold:

  • disk_space_check_interval = time/0 β€” the time interval for the periodic disk space check. the default is 30 minutes ⏰
  • disk_almost_full_threshold = float() β€” the threshold, as a percentage of total disk space, for how much disk can be utilized before the disk_almost_full alarm gets set. the default is 0.80 (80%) πŸ“
  • disksup_posix_only = bool() β€” specifies whether the disksup helper process should only use POSIX conformant commands (true) or not. the default is false. setting this parameter to true can be necessary on embedded systems with stripped-down versions of Unix tools like df. the returned disk data and alarms can be different when using this option. ⚠️ the parameter is ignored on platforms that are known to not be POSIX compatible (Windows and SunOS). πŸ™ˆ

see config for the info on how to change the value of configuration parameters. πŸ’–

πŸ‘€ See Also

alarm_handler, os_mon


πŸ¦‹ DATA TYPES πŸ¦‹

time()

pos_integer() |
{TimeUnit :: erlang:time_unit(), Time :: pos_integer()}.

time unit used for disklog APIs.

supported units are:

  • integer() >= 1 β€” the time interval in minutes.
  • {TimeUnit, Time} β€” the time interval Time in a time unit specified by TimeUnit, where TimeUnit is of the type erlang:time_unit/0 and Time is a positive integer. the time interval needs to be at least one millisecond long. ⏱️

πŸ”₯ FUNCTIONS πŸ”₯

get_almost_full_threshold() -> Percent :: integer().

returns the threshold, in percent, for disk space utilization. that's it, that's the whole function. πŸ’…

get_check_interval() -> Milliseconds :: timer:time().

returns the time interval, in milliseconds, for the periodic disk space check.

get_disk_data() -> [DiskData]

when
    DiskData :: {Id, TotalKiB, Capacity},
    Id :: string(),
    TotalKiB :: integer(),
    Capacity :: integer().

returns the result of the latest disk check. πŸ’Ύ

Id is a string that identifies the disk or partition. TotalKiB is the total size of the disk or partition in kibibytes. Capacity is the percentage of disk space used.

this function is asynchronous in the sense that it does not invoke a disk check β€” it just returns the latest available value she's got on hand. she's not gonna go run and check for you, bestie, she'll hand you what she already knows. 🫢

returns [{"none",0,0}] if disksup is not available. 😭

get_disk_info() -> [DiskData]

when
    DiskData ::
        {Id, TotalKiB, AvailableKiB, Capacity},
    Id :: string(),
    TotalKiB :: integer(),
    AvailableKiB :: integer(),
    Capacity :: integer().

immediately fetches total space, available space and capacity for local disks. like right now, no waiting. πŸ”₯

Id is a string that identifies the disk or partition. TotalKiB is the total size of the disk or partition in kibibytes. AvailableKiB is the disk space used in kibibytes. Capacity is the percentage of disk space used.

returns [{"none",0,0,0}] if disksup is not available.

get_disk_info(Path :: string()) -> [DiskData]

when
    DiskData ::
        {Id, TotalKiB, AvailableKiB, Capacity},
    Id :: string(),
    TotalKiB :: integer(),
    AvailableKiB :: integer(),
    Capacity :: integer().

immediately fetches total space, available space and capacity for a path. πŸ“

Id is a string that identifies the disk or partition. TotalKiB is the total size of the disk or partition in kibibytes. AvailableKiB is the disk space used in kibibytes. Capacity is the percentage of disk space used.

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. πŸ’€

set_almost_full_threshold(Float :: float()) -> ok.

changes the threshold, given as a float (0.0 =< Float =< 1.0), for disk space utilization.

the change will take effect during the next disk space check and is non-persist. that is, in case of a process restart, this value is forgotten and the default value will be used. see Configuration above. πŸ™ˆ

set_check_interval(time()) -> ok.

changes the time interval for the periodic disk space check.

the change will take effect after the next disk space check and is non-persist. that is, in case of a process restart, this value is forgotten and the default value will be used. see Configuration above. 😭


and that's the whole page, bestie!! πŸŽ€ this one's brought to you by Ericsson AB, os_mon version 2.12, dated disksup(3). go forth and never let a disk fill up on your watch. periodt. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from