How to revive hard drive using Diskpart on Windows 8.1 after data corruption (step by step)

Opened hard drive

After installing Windows 8.1 Update on my PC I had some issues with one of the hard drives, for some reason looking into the Task Manager I noticed 100% “Active time” constantly in the secondary hard drive. Issue that made the computer pretty slow even though the Windows drive is a Solid State Drive. The problem end up being data corruption, and although I was able to fix the drive, the solution didn’t come cheap. 

Starting with the troubleshooting process, I opened the command prompt and I tried the Check Disk utility using the following command: 


But I only stumbled upon an error message that read: “The type of the file system is RAW. CHKDSK is not available for RAW drives.” — By the way the /F switch is used to fix the error on the disk, /R locates bad sectors and recovers readable information (implies /F), and /X forces the volume to dismount first if necessary.

Then after rebooting the PC, I started getting many disk errors that led me to a second disk utility in Windows: Diskpart. This is a very powerful disk utility that can help you to perform really nifty operations to get the a hard drive up and running again. But instead of starting the utility within Windows, I rebooted the computer using the Windows 8.1 installation USB media and I used the “Repair your computer” environment to get access to the command prompt. Then I ran Diskpart using the following commands: 

List Disk 
Select Disk 1 

The commands listed above starts Diskpart, list all the hard drive installed in your system, selects the drive with errors (the number will be different on each situation, choose carefully), and performs a house cleaning. Basically the clean command removes any and all partitions from selected drive. 

Although, the command Clean was supposed to remove all the partitions, after performing the commands, I rebooted the computer once again, and I was able to get back to the drive (At this point if you don’t have any backup, I would recommend to copy as much files as you can off the drive), but not for long. So because I had a previous backup of my files I decided to re-format drive to start clean again. I try the Format utility, but the operation was unable to complete successfully. 

At this point I started to think I was dealing with a bad hard drive, then I remember sometimes Windows just doesn’t like drives. And here it is when having a second PC can help… My next step was to remove the possible “bad hard drive” from the PC and temporarily connect it to another Windows PC. After installing the drive, I immediately fired up the command prompt as administrator and I started Diskpart and entered the following commands: 

list disk 
select disk 1 
create partition primary 
select partition 1 
format FS=NTFS 
assign letter=D 
Important: Before removing the hard drive make sure to unlink any path you have configured to the secondary drive. For example, if you change the location of the Documents folder to the secondary drive, change it back to defaults. If you leave any path linked to the bad drive after formatting, Windows 8.1 won’t boot, and you’ll get an error message “An operating system wasn’t found try disconnecting any drives that don’t contain an operating system.”

Performing the above commands basically removes and recreates a primary partition, sets it as active partition, formats it with NTFS, which is the most common file format supported in Windows, and assigns a new drive letter — in this case D –. And as I suspected everything worked, but let me warn you that this action deleted all the files, however I was able to salvage the hard drive in question. Finally, I reconnected the drive to my main PC and restored the files from backup.