Invalid Class Name

Hard Drive Error: Invalid Class Name – Fix This Fast

Hard drive won't initialize because Windows can't read the partition table. Real fix: rebuild MBR or GPT without losing data.

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.

  1. Open Command Prompt as admin — hit Start, type cmd, right-click and choose "Run as administrator."
  2. Type diskpart and press Enter. Wait for the prompt to change to DISKPART>.
  3. Type list disk. Note the disk number of the broken drive—it'll be something like Disk 1, maybe with no size listed.
  4. Type select disk X (replace X with the number from step 3). You'll see "Disk X is now the selected disk."
  5. Type clean and press Enter. This wipes the partition table completely. Yes, it nukes everything. No undo button.
  6. Type create partition primary and press Enter. That builds a fresh partition table.
  7. Type format fs=ntfs quick and press Enter. Quick format takes seconds.
  8. Type exit twice 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.

Related Errors in Hardware – Hard Drives
Fix RAW External Drive Not Accessible Without Formatting 0XC00D2712 NS_E_DRM_LICENSE_STORE_ERROR (0XC00D2712): DRM License Storage Corrupted 0X80030021 STG_E_LOCKVIOLATION (0X80030021): The One Fix That Works 0XC0000167 STATUS_FLOPPY_UNKNOWN_ERROR (0XC0000167) Fix on Windows 10/11

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.