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

[OSX] Disk partitions and Disk io counters #1509

Closed
valh1996 opened this issue May 9, 2019 · 0 comments
Closed

[OSX] Disk partitions and Disk io counters #1509

valh1996 opened this issue May 9, 2019 · 0 comments
Assignees

Comments

@valh1996
Copy link

valh1996 commented May 9, 2019

Platform

  • OSX Mojave 10.14.4
  • psutil 5.6.2

In addition, I have:

  • An internal hard disk with my 256 GB pro macbook
  • 256 Gb external hard disk drive (Samsung SSD)
    ===

Bug description
When I retrieve the partitions (psutil.disk_partitions(all=False)), I get the following:

{
  '/dev/disk1s1': {'total': 250685575168, 'mountpoint': '/', 'fstype': 'apfs', 'used': 198136061952, 'free': 
  47547224064, 'percent': 80.6}, 
  '/dev/disk1s4': {'total': 250685575168, 'mountpoint': '/private/var/vm', 'fstype': 'apfs', 'used': 
  4295323648, 'free': 47547224064, 'percent': 8.3},
   '/dev/disk2s1': {'total': 250047627264, 'mountpoint': '/Volumes/ssd-t5', 'fstype': 'exfat', 'used': 
  121564823552, 'free': 128482803712, 'percent': 48.6}
}

And when I want to calculate the I/O for each of the disks (psutil.disk_io_counters(perdisk=True)), here is the result:

{
  'disk0': {'read_count': 26593782, 'write_count': 179212515, 'read_bytes': 210576470016, 'write_bytes': 
  2045853970432, 'read_time': 5858808, 'write_time': 33352953},
  'disk2': {'read_count': 812, 'write_count': 310, 'read_bytes': 21601792, 'write_bytes': 4809728, 'read_time': 
  327, 'write_time': 92}
}

What I don't understand is that the I/Os give me the disk0 and the disk2, but what is the link with the partitions /dev/disk1s1 and /dev/disk1s4 ????

It seems that it returns the result returned by the df -H command:

Filesystem      Size   Used  Avail Capacity iused               ifree %iused  Mounted on
/dev/disk1s1    251G   198G    47G    81% 4299257 9223372036850476550    0%   /
/dev/disk1s4    251G   4.3G    47G     9%       4 9223372036854775803    0%   /private/var/vm
/dev/disk2s1    250G   122G   128G    49%  927466              980246   49%   /Volumes/ssd-t5

No disk0 appears so far!

Except if I run diskutil list :

MacBook-Pro:~ user$ diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.7 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.7 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            198.4 GB   disk1s1
   2:                APFS Volume Preboot                 45.8 MB    disk1s2
   3:                APFS Volume Recovery                522.7 MB   disk1s3
   4:                APFS Volume VM                      4.3 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *250.1 GB   disk2
   1:               Windows_NTFS ssd-t5                 250.1 GB   disk2s1

Am I the one who's doing it the wrong way? I would simply like to recover the I/O for each of the disks and inside each disk to have the list of partitions with the disk_usage of each mountpoint. Store it all in a dictionary. But the above concern blocks me in this process...

Best regards

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

2 participants