How to Format a Write-Protected Pen Drive or Memory Card (2025 Guide)
How to Format a Write-Protected Pen Drive or Memory Card (2025 Guide)
Is your USB pen drive or memory card write-protected and refusing to format or delete files? This step-by-step guide shows how to remove write protection and safely format your device on Windows, macOS, and Linux. Follow the instructions carefully — formatting erases all data.
What Causes Write Protection?
Write protection prevents files from being changed or deleted. Common causes:
- Locked switch on an SD adapter
- File system corruption
- Windows registry protection flag
- Malware or bad sectors
- Failing memory chip or controller
1. Check the Physical Lock
If you use an SD or microSD card, look for the tiny lock switch on the full-size adapter. Slide it to the unlocked position and retry. Also try a different card reader or USB port.
2. Format from Windows (File Explorer)
- Open This PC → right-click the drive → Format…
- Pick
exFAT(recommended) orFAT32, check Quick Format, then Start.
If you see "The disk is write-protected", continue to DiskPart below.
3. Remove Write Protection with DiskPart (Windows)
Open Command Prompt as administrator and run:
diskpart
list disk
select disk X <-- replace X with the number of your USB drive
attributes disk clear readonly
clean
create partition primary
select partition 1
format fs=exFAT quick
assign
exit
4. Registry Fix (Windows)
If DiskPart didn't work, try this registry change:
- Press Win + R, type
regeditand press Enter. - Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control. - If
StorageDevicePoliciesdoesn't exist, create it as a key. - Inside it, create a
DWORD (32-bit)value namedWriteProtectand set it to0. - Restart and try formatting again.
5. macOS: Disk Utility & Terminal
Disk Utility (GUI): Open Disk Utility → select device → Erase → Format: ExFAT or MS-DOS (FAT) → Erase.
Terminal (if Disk Utility fails):
diskutil list
sudo diskutil eraseDisk ExFAT MYDRIVE MBRFormat /dev/diskN
6. Linux: identify, clear readonly & reformat
Use these commands (replace sdX with your device like sdb):
lsblk
sudo umount /dev/sdX1
sudo hdparm -r0 /dev/sdX
sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress
sudo parted /dev/sdX mklabel msdos
sudo mkfs.vfat -F32 /dev/sdX1
Warning: Make sure you choose the correct disk to avoid erasing the wrong drive.
7. SD Formatter (Official Tool)
If your SD/microSD still won't format, use the official SD Association "SD Memory Card Formatter" — it often resolves problems regular formatters can't.
8. Manufacturer Tools
Brand-specific tools can help revive stubborn USB drives. Search your vendor's website for format or recovery utilities (SanDisk, Kingston, Transcend, Samsung, HP, etc.).
9. When to Replace the Drive
If every method fails, the drive's controller is likely in permanent read-only mode. At that point, the safest option is to replace the drive. If the data is critical, consult a professional data recovery service.
Quick Recap
| Step | Method | Works On |
|---|---|---|
| 1 | Check physical lock | SD / microSD |
| 2 | File Explorer / Disk Management | Windows |
| 3 | DiskPart | Windows |
| 4 | Registry fix | Windows |
| 5 | Disk Utility / Terminal | macOS |
| 6 | hdparm / dd / parted | Linux |
| 7 | SD Formatter | SD cards |
| 8 | Vendor tools | Brand USBs |