I copied an ISO image over a USB drive, can I format it to use it as a storage device again

formattingpartitioningusb-flash-drive

I have a 4GB USB drive and I wrote an iso file to it. Now I want to delete the data on it. Is there any way to take the space back?

I used Linux to burn the iso file following these instructions.

At that time, I thought it would be just like using Pendrive Linux to write the iso so I could format the USB disk if I wanted to get storage back but I was wrong. It was like burning an iso file to CD/DVD, meaning that data was burned but cannot be deleted, now I've lost 3GB of storage.

How can I restore the Flash disk to being a normal storage device?

Best Answer

The term 'burning' does not apply to USB flash storage. Even if some people still call it 'burning' when you write ISO images, that does not matter at all. The USB stick's memory stores the ISO image's contents in exactly the same way that it would store regular files – that is, they can be erased and overwritten with something else.

The only difference here is that the ISO image was written on top of the partition & filesystem information that the OS would use to decide how much space is available. So instead of a 4 GB partition covering the entire flash memory, the OS now sees the partitions that were in the ISO image – that is, a ~1 GB partition with Linux, and 3 GB of "unused" space.

On Linux, you could use any partitioning tool (like the graphical GParted) to just erase all existing partitions and create a full-sized one again, then format that partition with FAT32 as usual.

Unfortunately Windows likes to discriminate against removable disks and USB sticks, but it's still possible to erase the partition information using dd for Windows`, and Windows would just ask to "format" the USB stick afterwards. This command would nuke the first megabyte, which should really be enough to make the OS think the entire disk is unpartitioned.

dd.exe --filter=removable if=/dev/zero of=\\?\Device\Harddisk?\Partition0 bs=1M count=1

Of course, run dd.exe --list first, and replace Harddisk? with the exact name of your USB stick. (Be careful to not erase your system disk's partition table, even though --filter=removable should prevent that.)

Related Question