How do I restore a USB flash drive back to its original state? Or how can I reset a USB drive to factory settings? After having tooled around with a USB Linux version using your dd raw image overwritten or multi partitioned flash drive, you might find it necessary to revert back to a single Fat, Fat32, exFAT or NTFS partition. Essentially resetting or restoring the USB flash drive back to its original state. This allows the Reset USB drive to be detected, readable, and useable again by all computers.
You might find it necessary to restore a USB after working with tools such as Etcher to burn an ISO or Win32 Disk Imager to write an image. Depending on the file used, these tools can make your USB device appear corrupted or unreadable. In some cases, the flash drive might not be assigned a drive letter and the USB not detected by your Computer. This is because these tools use raw-write style dd tasks to put an .img or .iso file on a USB flash drive. As a result, the existing boot record, partition table data, and filesystem is overwritten with that of the raw image file.
Windows users can follow the instructions below to Repair or Restore a Flash Drive using Diskpart, BOOTICE, or the SD Formatter. Mac OS users should also be able to use the SD tool. For those working from Linux this task can easily be accomplished via fdisk. As shown in the related the Linux Flash Drive Restoration tutorial.
Restore a USB Flash Drive from Windows, Linux, or Mac OS
How to Restore a USB Flash Drive using Diskpart in Windows
- Open a command Prompt as administrator (cmd.exe).
- Type Diskpart then press enter.
- Next type List Disk then press enter.
- Type Select Disk X (where X is the disk number of your USB drive) then press enter.
- Then type Clean and press enter. * If Error, See Note Below
- Next type Create Partition Primary then press enter.
- Type Format fs=exFAT Quick then press enter.
Note: (for 32GB and smaller drives, use fs=Fat32) instead. - Then type Active and press enter.
- Finally, type Exit then press enter to Quit.
DiskPart Has Encountered an Error: Access is Denied
NOTE: If you encounter an error like this, simply repeat step 5.
DISKPART> clean
DiskPart has encountered an error: Access is denied.
See the System Event Log for more information.
If repeating DiskPart clean does not work, you’ll need to Fix the Corrupted USB Flash Drive with dd. This appears to be because Windows is unable to detect the Linux file format.
Restore a USB with SD Formatter Tool – Windows/Mac OS
Windows and or Mac OS users can also use the SD Formatter Tool to reformat and restore a USB to its original state.
Though originally designed to be used on SD cards, this tool can be used to reformat a flash drive as well.
- Download and launch the SD Formatter Tool.
- Select your flash drive from the drop list.
- Choose your Formatting Option.
- Then Press Format.
Restoring a USB key to its original state using Linux
The following manual tasks to restore a USB drive can be performed from a Linux terminal window.
A. First we need to delete the old partitions that remain on the USB key.
- Open a terminal ctrl+alt+t and type sudo su.
- Type fdisk -l and note your USB drive letter.
- Then type fdisk /dev/sdx (replacing x with your drive letter).
- Next type d to proceed to delete a partition.
- Type 1 to select the 1st partition then press enter.
- Then type d to proceed to delete another partition, if necessary. (fdisk should automatically select the second partition).
B. Next we need to create the new partition.
- Type n to make a new partition.
- Then type p to make this partition primary then press enter.
- Type 1 to make this the first partition then press enter.
- Next press enter to accept the default first sector.
- Press enter again to accept the default last sector.
- Type w to write the new partition information to the USB key.
- Type umount /dev/sdx1 (replacing x with your drive letter).
C. The last step is to create the fat32 or exFAT filesystem.
- For Fat32, type mkfs.vfat -F 32 /dev/sdx1 (replacing x with your drive letter)
- For exFAT, (if using Ubuntu or Debian), type apt install exfat-utils and then type mkfs.exfat /dev/sdx1 (replacing x with your drive letter)
That’s all there is to it, you should now have a restored USB key with a single exFAT or fat 32 formatted partition that can be read from any computer.
Using BOOTICE to repair a corrupted USB drive
Windows users can also use BOOTICE to format and restore a flash drive. The tool uses a simple and intuitive GUI.
NOTE: It looks like BOOTICE may no longer be in development as the last revision was in 2016.
- Download, extract, then run Pauly’s BOOTICE Tool.
- (1.) Select your USB Flash Drive from the list, (2.) Click Parts Manage.
- (1.) Click Repartitioning.
- (1.) Under Disk Mode, Choose USB-FDD, USB-HDD, or USB-ZIP mode I use USB-HDD as it works with every BIOS I use. (2.) Click OK.
There you have it. Several methods to help you restore a USB flash drive back to original state with full capacity.
Note: USB not detected? If none of the options mentioned above worked to help you restore a USB. Or if you need to recover from a corrupted USB flash drive or SD card. Here is a last resort you can try before tossing your drive or sd card into the trash. Windows users need to download dd.exe to follow along.
- Open up a terminal (or command prompt in Windows)
- Next, we will wipe out the partition table and leading filesystem information.
For Windows users using dd.exe. Replacing X with your actual USB drive letter, type the following and then press enter;dd if=/dev/zero od=X: count=1 bs=4096 --progress
If that fails, try the following, instead. Replacing 1 with your disk number which can be found by running diskmgmt.msc
dd if=/dev/zero of=\\?\Device\Harddisk1\Partition0 count=1 bs=4096 --progress
For Linux users. Replacing X with your actual USB device, type the following and then press enter;
dd if=/dev/zero of=/dev/sdX count=1 bs=4096 status=progress
- Then try to format your USB Flash Drive using any method you want.
Note: You can also Recover Lost USB Storage Space. This is especially useful if you’ve used dd to raw write an ISO image to your USB, and now the device appears smaller than its original capacity and is no longer usable for traditional storage purposes.