Question about windows disks and partitions

22 views
Skip to first unread message

Dimitris Diamantis (ftso)

unread,
Nov 27, 2011, 8:32:07 PM11/27/11
to psutil
Hi all!

I use the command "psutil.disk_partitions(all=False)" on windows xp
(guest on a linux virtualbox host) and return the device "C:" with
mountpoint "C:",
the device "D:" with mountpoint "D:"
and the
device "F:" with mountpoint "F:".

C and D are partitions on the same disk and F a partition of a usb
flash drive.


Then i run the command "psutil.disk_io_counters(perdisk=True)"
and return the output below:
{'PhysicalDrive1': iostat(read_count=6, write_count=26,
read_bytes=49152L, write
_time=5210L, write_time=956L), 'PhysicalDrive0':
iostat(read_count=2970, write_c
s=64539136L, write_bytes=245547008L, read_time=4647317L,
write_time=2028993L)}


The i remove the usb flash drive and i run again the command
"psutil.disk_io_counters(perdisk=True)"
The output was same as above.


Why the flash drive not shown on the output of the first run?

Is there any way to map the PhysicalDrive[x] of the disk_io_counters
output with the letters (C,D, F, etc) of disk_partitions output?

Thanks!

Dimitris Diamantis (ftso)

unread,
Nov 28, 2011, 5:20:21 AM11/28/11
to psutil

On Nov 28, 3:32 am, "Dimitris Diamantis (ftso)" <kots...@gmail.com>
wrote:


> C and D are partitions on the same disk and F a partition of a usb
> flash drive.

I noticed a mistake.
C and D are partitions of several disks and not the same.
Sorry.

Dimitris Diamantis (ftso)

unread,
Dec 2, 2011, 11:59:09 AM12/2/11
to psutil
anyone?

Jay Loden

unread,
Dec 2, 2011, 2:07:52 PM12/2/11
to psu...@googlegroups.com
I'm not 100% sure what would cause the problem but I have a guess. 

The way our code works is it tries to enumerate all the drives by iterating through PhysicalDrive numbers and as soon as we hit an invalid one, we stop enumerating the drives. Possibly since this is a USB drive, it does not show up as a PhysicalDrive object, or maybe your drives skip a number in the enumeration causing our code to exit before it gets to the USB drive. 

If you download the systinernals WinObj too: http://technet.microsoft.com/en-us/sysinternals/bb896657.aspx it can enumerate the namespace objects on your system and we can figure out if my hypothesis is correct. 

-Jay


--
You received this message because you are subscribed to the "Python process utilities (psutil)" project group:
http://code.google.com/p/psutil
To post to this group, send email to psu...@googlegroups.com
To unsubscribe from this group, send email to psutil-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/psutil

Dimitris Diamantis (ftso)

unread,
Dec 4, 2011, 7:05:04 PM12/4/11
to psutil

On Dec 2, 9:07 pm, Jay Loden <jlo...@gmail.com> wrote:
> I'm not 100% sure what would cause the problem but I have a guess.
>
> The way our code works is it tries to enumerate all the drives by iterating
> through PhysicalDrive numbers and as soon as we hit an invalid one, we stop
> enumerating the drives. Possibly since this is a USB drive, it does not
> show up as a PhysicalDrive object, or maybe your drives skip a number in
> the enumeration causing our code to exit before it gets to the USB drive.
>

> If you download the systinernals WinObj too:http://technet.microsoft.com/en-us/sysinternals/bb896657.aspxit can


> enumerate the namespace objects on your system and we can figure out if my
> hypothesis is correct.
>

I ran the WinObj and i took a screenshot...
http://dl.dropbox.com/u/1320617/Linux_Photos/win_psutil_winobj.jpeg

I can't understand where is the problem :S

On linux the command "psutil.disk_io_counters(perdisk=True)" returns
info per partition and on the windows info per disk?

I think that the best output for windows should be like this:
{'C:': iostat(blablabla), 'D':iostat(blablabla), etc...}

Jay Loden

unread,
Dec 4, 2011, 7:44:24 PM12/4/11
to psu...@googlegroups.com
On Sun, Dec 4, 2011 at 7:05 PM, Dimitris Diamantis (ftso) <kot...@gmail.com> wrote:
I ran the WinObj and i took a screenshot...
http://dl.dropbox.com/u/1320617/Linux_Photos/win_psutil_winobj.jpeg

I can't understand where is the problem :S

On linux the command "psutil.disk_io_counters(perdisk=True)" returns
info per partition and on the windows info per disk?

I think that the best output for windows should be like this:
{'C:': iostat(blablabla), 'D':iostat(blablabla), etc...}

I'm not really sure based on the output, but I would recommend opening an issue on the bug tracker as this needs more investigation. I tried to reproduce on my VM system and in my case I get an empty dict returned (probably indicates drive 0 is returning an invalid handle and stopping enumeration early). 

-Jay
Reply all
Reply to author
Forward
0 new messages