4

I am trying to get raw disk access using python on windows to drives >2TB using python.

Everything works great for disks under 2TB using wmi to find details about the disk size but for a 4TB drive it only sees the first 2TB.

I assume it is because wmi is a wrapper for a wmi32 call so can only address up to 2TB 2^32.

Sample code:
import wmi
w=wmi.WMI()
w.Win32_DiskDrive()
w.Win32_DiskDrive()[4].size
w.Win32_DiskDrive()[4].DeviceID

u'2199020382720'
u'\\.\PHYSICALDRIVE6'

I can then use the DeviceID to access the raw disk like a file.
in=open('\\\\.\\PHYSICALDRIVE6',"rb")
in.seek(1024)
data=in.read(512)

My question is if there is any way to access the full 4TB under python in windows. I have looked for a wmi64 module to no avail. I have looked at wmic command line stuff but that appears to be the same 32 bit wrapper. My OS is Win7 64 bit and python is compiled for 64bit.

If i try and seek past the 2TB I get a IOError [Errno13] Permission Denied

Is there any way or module under python that will allow me raw disk access above 2TB?

Thanks.

  • WMI is not related to opening the file.. if "wmi to find details about the disk size" means something about the result of `w.Win32_DiskDrive()[4].size`? Write about this.. however, "try and seek past the 2TB [and] get a IOError [Errno13] Permission Denied" is not related to WMI. – user2864740 Aug 24 '17 at 00:23
  • Yep very good point. So wmi is returning a 32 bit size of a 4TB drive and using a raw read is only letting me see the first 2TB. Would that point me more to an OS issue? – Robert Fearn Aug 24 '17 at 00:29

0 Answers0