After having tooled around with a USB Linux version using your dd raw image overwritten or multi partitioned flash pen drive, you might find it necessary to revert it back to a single Fat, Fat32, exFAT or NTFS partition. Essentially recovering or restoring the USB Flash Drive back to its original state. This allows the storage device to be detected, readable, and useable again by all computers.
You’ll find this particularly necessary 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 no longer be 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.
Easily Restore a USB Flash Drive from Windows, Mac OS, or Linux
How to Restore a USB Flash Drive using Diskpart – 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.
- Next type Create Partition Primary then press enter.
- Type Format fs=Fat32 Quick then press enter (You can also use NTFS or exFAT).
- Then type Active and press enter.
- Finally, type Exit then press enter to Quit.
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 your USB key to its original state using Linux
The following manual tasks to restore a USB drive can be performed from a 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 fat filesystem.
- Type mkfs.vfat -F 32 /dev/sdx1 (replacing x with your USB key drive letter)
That’s all there is to it, you should now have a restored USB key with a single fat 32 partition that can be read from any computer.
Using BOOTICE to repair a 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.