4

I have a problem with my USB flash drive. I created an Ubuntu 16.04 installation on the drive using the Ubuntu standard tool to "Create a Bootable Disk", and now I can't format this USB drive.

When I delete the Ubuntu installation from this drive it just keeps coming back and and free memory on this drive is 0 mb.

How can I fix it?

2
  • What's the output of fdisk -l? Feb 10, 2017 at 11:34
  • I had the same problem and I solved with "Format..." and turning on the "Erease" button (I was not doing that before)
    – Mil
    Jul 25, 2020 at 13:19

2 Answers 2

3

I suggest that you install and use mkusb, which can restore the USB drive to a standard storage drive (with an MSDOS partition table and a partition with the FAT32 file system). See these links

mkUSB-quick-start-manual.pdf

help.ubuntu.com/community/mkusb

mkusb version 12 alias mkusb-dus: enter image description here

Often the problem is some data that is 'tricking' the software to think that the pendrive does not work, even when it is good, and it is enough to wipe the first megabyte to get rid of that data. I think this is the case with your drive. You 'look at' the drive with a tool, that does not recognize or understand correctly the structure of the boot system, which was cloned from the iso file.


There are many ways that a USB pendrive can fail. So it is worth trying different things. If mkusb fails, try in another USB port, in another computer and with another operating system. But there is a limit, when you have to accept that the pendrive is probably damaged beyond repair, at least with tools available to normal users like you and me. See this link

Pendrive lifetime

But if there are valuable data in the drive, you should think differently and use special methods to restore/repair the file system or even recover the data without any file system. See this link,

Repair the partition table and file system of a pendrive

1
  • 1
    I can change the wording ...
    – sudodus
    Feb 9, 2017 at 12:18
1

If you need to wipe the data to have a usable usb drive you can try with gparted. Delete the current partition and create a new one, this will probably solve your problem. If this does not work you can fill the usb with 0 using dd.

sudo dd if=/dev/zeros of=/dev/<your_usb_drive> bs=4096

<your_usb_drive> should be something like sdb or sdc. To find out plug your usb drive and use

mount | grep /media/

It will give you a line like

/dev/sdc1 /media/your_username/<something> type... 

The first part is what you are looking for. Remove the number from sdc1. sdc1 actually stands for the partition, you want to dump the entire usb drive so remove the number. Let it work for a while, it does not give you any output that it's working until it has finished. Time depend on the size of your usb drive. Once it has finished open gparted and create a new partition.

2
  • 1
    I've tried it with this outcome: dd: failed to open '/dev/zeros': No such file or directory
    – Sebastian
    Feb 22, 2018 at 14:18
  • use /dev/zero instead of /dev/zeros
    – someuser
    Sep 7, 2018 at 7:37

Not the answer you're looking for? Browse other questions tagged .