How to Remove Write Protection from USB Using Diskpart
Table of Contents
- Introduction
- Why USB Drives Become Write-Protected
- Clear Read-Only Attribute with Diskpart
- Clean and Recreate Partition Using Diskpart
- Check Physical Write-Protect Switch
- Remove Write Protection via Registry
- Disable Write Protection Using Group Policy
- Run CHKDSK to Repair File System Errors
- Format USB Drive Using Diskpart
- Use Third-Party Formatting Tools
- Use Linux to Override Write Protection
- Prevent Future Write Protection with Safe Practices
- Advanced Technical Fixes
- Conclusion
- Related Guides
- Frequently Asked Questions
Introduction
When you encounter a write-protected USB drive, the fastest solution is to remove write protection from usb using diskpart. Diskpart is a powerful command-line tool built into Windows that can clear read-only attributes and restore full access.
To remove write protection from usb using diskpart, you need to run specific commands that reset the drive’s attributes and partition table. This guide provides 10 proven methods, starting with Diskpart and covering alternative solutions when Diskpart alone isn’t enough.
For official guidance, Microsoft’s documentation explains how to use Diskpart to manage disk attributes.
Additionally, the BitLocker documentation provides context on encryption-related write protection.
This article builds on those authoritative sources to deliver a complete step‑by‑step recovery plan.
For broader Windows troubleshooting, explore our Windows 11 troubleshooting hub which covers system‑level storage issues.
📌 Featured Snippet: To remove write protection from usb using diskpart, open Command Prompt as Administrator, type diskpart, then list disk, select your USB drive with select disk X, and run attributes disk clear readonly. If the attribute persists, use clean and recreate the partition.
Why USB Drives Become Write-Protected
Understanding why USB drives become write-protected helps you choose the right fix.
Write protection on USB drives can be caused by several factors. The most common causes include: physical lock switches on the drive casing, disk-level read-only attributes set via Diskpart or other tools, file system corruption triggering protection, malware or viruses enabling write protection, registry settings enforced by system policies, and hardware failure in the USB controller.
When you remove write protection from usb using diskpart, you are primarily addressing the disk-level read-only attribute. However, if the issue is physical or registry-based, Diskpart alone may not resolve it.
Never assume the drive is permanently damaged. Most write protection issues are fixable with the right approach.
Clear Read-Only Attribute with Diskpart
The primary method to remove write protection from usb using diskpart is clearing the read-only attribute.
- Press Win + X and select Terminal (Admin) or Command Prompt (Admin).
- Type
diskpartand press Enter. - Type
list diskto see all disks. - Identify your USB drive by its size. Type
select disk X(replace X with the correct number). - Type
attributes diskto view current attributes. - If Read-only is set to Yes, type
attributes disk clear readonly. - Type
attributes diskagain to verify the attribute is cleared. - Type
exitand test if you can write to the drive.
This is the most direct way to remove write protection from usb using diskpart. In most cases, this single command resolves the issue.
Clean and Recreate Partition Using Diskpart
If the read-only attribute cannot be cleared, you may need to clean and recreate the partition to remove write protection from usb using diskpart.
- Open Command Prompt as Administrator.
- Type
diskpartand press Enter. - Type
list diskand identify your USB drive. - Type
select disk X(replace X with your USB disk number). - Type
cleanto remove all partitions and data. - Type
create partition primaryto create a new partition. - Type
format fs=fat32 quick(orexfatfor drives larger than 32GB). - Type
assignto assign a drive letter.
Warning: This erases all data on the drive. Only use this method if you have backed up your files or the data is not important.
Check Physical Write-Protect Switch
Before using software, check for a physical switch that may cause the usb drive write-protected error.
- Look at the USB drive casing for a small sliding switch.
- If present, slide it to the Unlock position (often indicated by an open padlock icon).
- Reinsert the drive and check if you can write files.
Some drives have tiny switches that are easy to overlook. If the switch is broken or stuck, the drive may remain write-protected permanently.
Remove Write Protection via Registry
If Diskpart fails, registry keys may be enforcing write protection. This can prevent you from using diskpart to remove write protection from usb.
- Press Win + R, type
regedit, and press Enter. - Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. - If the WriteProtect DWORD exists, set its value to 0.
- If the key doesn’t exist, create it and set the DWORD to 0.
- Also check
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\RemovableStorageDevices. - Set DenyWriteAccess to 0 if present.
- Restart your computer and try Diskpart again.
Registry edits apply system‑wide, so multiple keys may need modification. Ensure you have admin rights.
Disable Write Protection Using Group Policy
Group Policy can enforce write protection on removable drives, overriding Diskpart commands.
- Press Win + R, type
gpedit.msc, and press Enter. - Navigate to Computer Configuration → Administrative Templates → System → Removable Storage Access.
- Find Removable Disks: Deny write access.
- Double‑click and set it to Not Configured or Disabled.
- Also check All Removable Storage: Deny write access and disable it.
- Restart your computer and retry Diskpart.
Group Policy overrides registry settings, so even if registry keys are correct, policy may still block writing.
Run CHKDSK to Repair File System Errors
File system corruption can trigger write protection. Run CHKDSK before or after using diskpart to remove write protection from usb.
- Open Command Prompt as Administrator.
- Type
chkdsk X: /f(replace X: with your USB drive letter). - Press Enter and wait for the scan to complete.
- If errors are found and repaired, check if the write protection is gone.
- If CHKDSK cannot run due to write protection, proceed with Diskpart first.
CHKDSK can fix logical errors that may be causing the drive to enter read‑only mode.
Format USB Drive Using Diskpart
If all else fails, formatting the drive using Diskpart can completely reset the drive and remove write protection.
- Open Command Prompt as Administrator.
- Type
diskpartand press Enter. - Type
list diskand select your USB drive. - Type
cleanto remove all partitions. - Type
create partition primary. - Type
format fs=fat32 quick(or exFAT for larger drives). - Type
assignto give the drive a letter.
Formatting erases all data but is often the final solution when Diskpart cannot clear the read-only attribute.
Use Third-Party Formatting Tools
When Diskpart fails, third‑party software can help remove write protection from usb using diskpart-like functionality.
- Download reputable tools like HP USB Disk Storage Format Tool or Rufus.
- Install and launch the tool.
- Select your USB drive and choose the file system.
- Enable Quick Format or Full Format.
- Click Start and wait for the process to complete.
These tools can sometimes bypass write protection that Windows refuses to override.
Use Linux to Override Write Protection
If Windows and Diskpart cannot remove write protection from usb using diskpart, Linux offers an alternative.
- Boot from a Linux Live USB (e.g., Ubuntu).
- Open Terminal and type
sudo fdisk -lto identify the drive. - Type
sudo hdparm -r0 /dev/sdX(replace sdX with your device). - If that fails, use
sudo dd if=/dev/zero of=/dev/sdX bs=1M count=10to wipe the first few sectors. - Then reformat the drive using
mkfs.fat -F32 /dev/sdX.
Linux treats read-only attributes differently and often can override them completely.
Prevent Future Write Protection with Safe Practices
After successfully removing write protection, adopt practices to prevent recurrence.
- Always use Safely Remove Hardware before unplugging USB drives.
- Regularly scan for viruses to prevent malware from enabling write protection.
- Avoid using cheap or counterfeit USB drives.
- Keep your system updated with the latest Windows updates.
- Backup important data regularly to avoid panic during write protection issues.
For comprehensive system protection, explore our clear cache guide to optimize your system performance.
Advanced Technical Fixes
For expert users, these advanced methods go beyond standard procedures.
Use Diskpart to Remove Volume Read-Only Attribute
If disk-level attributes are clear but the volume is still read-only, use select volume X followed by attributes volume clear readonly.
Low-Level Format Using Controller Tools
Some USB drives have specific controller chips that can be reset using manufacturer tools like MpTool or Phison Format Tool. This requires identifying the chip vendor.
Use Windows Registry to Force Write Access
Add the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start and set it to 3 to enable USB storage. Sometimes the service is disabled, preventing writes.
For additional Windows recovery techniques, see our guide on external hard drive not showing in Windows 11 for related storage issues.
Conclusion
To remove write protection from usb using diskpart, start with the attributes disk clear readonly command. If that fails, clean and recreate the partition. For persistent issues, check registry, Group Policy, and physical switches.
The success of each method depends on whether the issue is software-based or hardware failure. Typically, the Diskpart clear readonly command offers the highest success rate for the remove write protection from usb using diskpart scenario.
If the drive is physically damaged, replace it. Regular backups and safe ejection are the best defenses against write protection issues.
For additional Windows support, explore our Windows 11 troubleshooting hub to address other system issues.
Related Guides
- Windows 11 Troubleshooting Hub
- External Hard Drive Not Showing in Windows 11
- Fix Windows 11 Disk Usage 100%
- Fix Windows 11 Running Slow
- Fix Windows 11 File Explorer Not Responding
- Recover Deleted Photos from Windows 11
- How to Clear Cache
- Fix Windows 11 Update Stuck
Frequently Asked Questions
How do I remove write protection from USB using Diskpart?
Open Command Prompt as Admin, run diskpart, type list disk, select your USB drive with select disk X, then run attributes disk clear readonly.
What if Diskpart cannot clear read-only attribute?
If attributes disk clear readonly fails, try clean and recreate the partition. Also check physical switches, registry, and Group Policy for write protection settings.
Does Diskpart clean remove write protection?
Yes, the clean command removes all partitions and resets the drive, which effectively removes write protection. However, it also erases all data.
Why is my USB drive write-protected even after Diskpart?
If Diskpart cannot remove write protection, the drive may have a physical lock switch, registry policy, Group Policy, or hardware failure. Check each of these sources.
Can I remove write protection from USB without formatting?
Yes, use attributes disk clear readonly in Diskpart. This removes the read-only attribute without erasing data. If that fails, check registry and Group Policy.
What is the Diskpart command to check read-only status?
Run diskpart, select your disk with select disk X, then type attributes disk. The output will show if Read-only is Yes or No.
Does formatting a USB drive remove write protection?
Formatting can remove software-based write protection by resetting the file system. However, if write protection is caused by a physical switch or hardware failure, formatting won’t help.
How do I use Diskpart to format a write-protected USB?
Use diskpart, select the disk, run clean, then create partition primary, and format fs=fat32 quick. This completely resets the drive.
Can Linux remove write protection that Diskpart cannot?
Yes, Linux can sometimes override write protection using hdparm -r0 or low-level formatting tools. This is a good alternative when Windows tools fail.
How can I prevent USB write protection issues in the future?
Always use Safely Remove Hardware, regularly scan for viruses, keep your system updated, and avoid cheap or counterfeit USB drives.