Restore Your USB Key to its original state
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 pen drive back to its original state. This allows the storage device to be readable again, and usable 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. 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 Restoring your USB key from Windows, Mac OS, or Linux
How to Restore a USB drive using Diskpart – Windows
- Open a command Prompt as administrator (cmd.exe)
- Type Diskpart then press Enter
- Type List Disk then press Enter
- Type Select Disk X (where X is the disk number of your USB drive) then press Enter
- Type Clean then press Enter
- Type Create Partition Primary then press Enter
- Type Format fs=Fat32 Quick then press Enter (You can also use NTFS or exFAT)
- Type Active then press Enter
- Type Exit then press Enter
Restore a USB with SD Formatter Tool – Windows/Mac OS
Windows and or Mac OS users could use the SD Formatter Tool to reformat and restore a USB Drive.
Using BOOTICE to repair a USB drive
Windows users can also simply use BOOTICE to format and restore a flash drive. The tool uses a simple and intuitive GUI.
- 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
Restoring your USB key to its original state using Linux
The following manual tasks to restore a USB drive can be performed using 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
- Type fdisk /dev/sdx (replacing x with your drive letter)
- Type d to proceed to delete a partition
- Type 1 to select the 1st partition then press enter
- 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
- 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.