Quick Answer
Open Command Prompt as admin, run diskpart, then list disk, select disk X (your broken drive), then clean (wipes everything), create partition primary, format fs=ntfs quick. If you need the data, skip to the recovery steps below.
Why You're Seeing This
That "Invalid Class Name" error pops up when Windows tries to read a hard drive's partition table and chokes. I've seen it on everything from a 2012 Seagate 500GB drive to a brand-new Samsung 870 EVO SSD. The partition table—either MBR or GPT—gets corrupt, maybe from a sudden power loss, bad cable, or a partition tool that crashed mid-write. Last month, a client had it after his kid yanked the USB cable on an external drive. Windows basically says, "I can't figure out what this disk is supposed to be." The disk shows up in Disk Management as "Unknown, Not Initialized," and right-clicking gives you that useless error.
Fix Steps: The Main Fix (No Data Recovery Needed)
This assumes you don't need the data on the drive. If you do, skip to the alternative section below.
- Open Command Prompt as admin — hit Start, type
cmd, right-click and choose "Run as administrator." - Type
diskpartand press Enter. Wait for the prompt to change toDISKPART>. - Type
list disk. Note the disk number of the broken drive—it'll be something like Disk 1, maybe with no size listed. - Type
select disk X(replace X with the number from step 3). You'll see "Disk X is now the selected disk." - Type
cleanand press Enter. This wipes the partition table completely. Yes, it nukes everything. No undo button. - Type
create partition primaryand press Enter. That builds a fresh partition table. - Type
format fs=ntfs quickand press Enter. Quick format takes seconds. - Type
exittwice to get out. Your drive should now show up in File Explorer ready to go.
Alternative Fixes If the Main One Fails
Still getting the error after clean?
Rare, but happens. Might be a dead drive. Try a different SATA port or USB cable. Also check if the drive spins up—feel for vibration. No vibration? Drive's toast. Sorry.
Need to recover data first
Don't run clean. Instead, grab a tool like TestDisk (free) or R-Studio (paid, but worth it). Boot from a live Linux USB, mount the drive, and copy files off. Then use the main fix above to zap the partition table and start fresh. I've pulled data off a dozen drives this way—takes an hour but works.
Prevention Tip
Stop yanking USB drives without safely ejecting. And if you're using a desktop with spinning drives, invest in a UPS. Power spikes corrupt partition tables faster than you can blink. Also, back up your partition table once a year using diskpart or tools like Macrium Reflect. Saves your rear when this error shows up at 2 AM.