Skip to content

Commit

Permalink
chore: calculate used storage in all partitions
Browse files Browse the repository at this point in the history
check for all available partitions and calculate storage among all them
  • Loading branch information
aldo-94vp authored Apr 18, 2024
1 parent 2a25630 commit 2bc5092
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/sensors/sensors_librehardwaremonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,11 @@ def virtual_free() -> int: # In bytes
class Disk(sensors.Disk):
@staticmethod
def disk_usage_percent() -> float:
return psutil.disk_usage("/").percent
disks = psutil.disk_partitions(all=True)
usage = 0
for disk in disks:
usage = usage + psutil.disk_usage(disk.device).percent
return usage / len(disks) # return all used space among all disks

@staticmethod
def disk_used() -> int: # In bytes
Expand Down

0 comments on commit 2bc5092

Please sign in to comment.