0

In python if I know the volume label of a USB mass storage device is there a way to get its.

Drive letter Windows
Mount Point Linux
Mount Point OSX

Originally I was thinking either the sys library or the os library. i ahve found another library called PYUSB. Still researching it. but wondered if anyone knew of a good solution.

3
Contributors
2
Replies
36
Views
2 Years
Discussion Span
Last Post by vegaseat
1

psutil is good.
Here a run on my windows and Mint(VirtualBox)

>>> import psutil
>>> psutil.disk_partitions()
[sdiskpart(device='C:\\', mountpoint='C:\\', fstype='NTFS', opts='rw,fixed'),
 sdiskpart(device='D:\\', mountpoint='D:\\', fstype='', opts='cdrom'),
 sdiskpart(device='E:\\', mountpoint='E:\\', fstype='NTFS', opts='rw,fixed'),
 sdiskpart(device='F:\\', mountpoint='F:\\', fstype='UDF', opts='ro,cdrom'),
 sdiskpart(device='G:\\', mountpoint='G:\\', fstype='NTFS', opts='rw,fixed')]
>>> psutil.disk_usage('C:\\')
sdiskusage(total=255953203200L, used=177126027264L, free=78827175936L, percent=69.2)

Mint:

>>> import psutil
>>> psutil.disk_partitions()
[partition(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,errors=remount-ro')]
>>> psutil.disk_io_counters()
iostat(read_count=32177, write_count=6804, read_bytes=833645568, write_bytes=317702144, read_time=123880, write_time=124128)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.