- To fix USB drive problems on Windows 11, open PowerShell (admin), run the “Get-Disk 7 | Clear-Disk -RemoveData” command to clear and repair the drive, and then run the command to create a new partition and set a drive letter.
- This process completely erases the USB flash drive data and partition to fix issues like corruption and other errors and then configures the drive as a fresh new device.
On Windows 11, when you connect a USB flash drive, you may receive the “Please insert a disk into USB drive” or “Windows was unable to complete the format” as you try to reformat it, which could indicate data corruption or something wrong happened to the storage.
Regardless of the reason, clearing the drive and re-creating the partition can fix most problems. On Windows 11, you can run some PowerShell commands to resolve these and other issues on a USB flash drive, SD card, and different removable drives. In addition, if the USB drive was configured as bootable installation media, this process will help you clean the drive to start with a fresh partition.
In this guide, you will learn the steps to repair any USB flash drive that is not accessible, and as a result, you can’t reformat it on Windows 11.
Repair USB drive using PowerShell on Windows 11
To repair a USB drive with PowerShell commands on Windows 11, use these steps:
Open Start on Windows 11.
Search for PowerShell, right-click the result, and select the Run as administrator option.
Type the following command to identify the USB flash drive and press Enter:
Type the following command to erase the entire drive and press Enter:
Get-Disk 7 | Clear-Disk -RemoveData
In the command, change “7” to the disk number of the drive you want to repair. If you specify the number incorrectly, you could wipe out the wrong drive causing data loss.
Type Y to confirm that you want to wipe the specified drive and press Enter.
Type the following command to create a partition using the NTFS file system and assign a name for the USB drive, and press Enter:
New-Partition -DiskNumber 7 -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel myUSBflash
In the command, change “7” with the disk number of the USB drive you want to repair and change “myUSBflash” with the name you want to use for the storage.
Type the following command to assign a drive letter to the removable drive and press Enter:
Get-Partition -DiskNumber 7 | Set-Partition -NewDriveLetter F
In the command, make sure to change “1” with the disk number of the flash drive to repair and change “F” with the letter to assign to the storage.
Once you complete the steps, the USB flash drive should appear accessible through File Explorer unless it’s physically broken, in which case, you will need a replacement.