Here I am trying to create a function to (eventually) support the wiping of drives using multiple specifications. The problem I am running in to, is when I try to write ZeroBlock to the disk, it gets written, but the code behaves as thou it has failed. the reason i say it worked is that it cleared the boot sector from the drive in my testing system
def WipeDisk(Drive, WipeSpec, Passes):
DiskSize = int(System.HDD[Drive].Size)
DiskSect = int(System.HDD[Drive].Sectors())
SectSize = int(System.HDD[Drive].SectSz)
System.HDD[Drive].Start = time.time()
if (WipeSpec == "Zero"):
with open("/dev/zero", "rb") as Zero:
ZeroBlock = Zero.read(SectSize)
Zero.close()
Pass = 0
with open(System.HDD[Drive].Device, "wb") as Disk:
while (Pass < Passes):
Current = 1
while (Current < DiskSect):
if (Disk.write(ZeroBlock)):
if (Current %((DiskSect*Passes)/100) == 0):
(variable updates)
if (Current == DiskSect):
Pass = (Pass+1)
else:
System.HDD[Drive].Error = 1
Pass = Passes
break
Current = (Current+1)
if (Pass == Passes):
System.HDD[Drive].Current = Current
System.HDD[Drive].Percent = "100"
System.HDD[Drive].Complete = 1
Disk.close()
else:
print("Unknown Wipe Specification: "+WipeSpec)