I have a MicroSD card in a USB adapter (which plugs into a USB port on my machine, and acts like a USB flash drive). I was using Unetbootin to make this a bootable USB flash drive with Kubuntu. But I needed to cancel while it was working. So I killed the Unetbootin process from the console.
Since then, I can't format the MicroSD or delete the folder that Kubuntu made. I have also tried mkdosfs
, with no success. I can't mount the drive anymore either? What can I do to make this drive usable again?
Trying to create a new partition table in GParted, as described in Eliah Kagan's answer, does not work. It fails with the error message "imposible crear tabla de particiones" ("unable to create a partition table").
Best Answer
Analysis of the problem
Memory cards and USB pendrives have the same kind of hardware inside, so the same methods are relevant to both kinds of devices. The term 'drive' can refer to a USB pendrive as well as a memory card (and the memory card can be connected via a USB adapter or a built-in slot in the computer).
Confusion: There is some data in the drive, that makes the partitioning tool confused, to think that the drive does not work. In this case you can simply 'wipe' part of the drive (overwrite with zeros). It is usually enough to wipe the first megabyte, the megabyte at the head end of the drive.
The drive is read-only: I do not mean that there is a read-only file system, but that the drive is readable but not writable (like a CDROM or DVD). This might be caused by some help system or competing system, so it is worthwhile to try according to this list,
The drive cannot be found: In order to use the tools for repair and partitioning, that are available to normal users like you and me, the drive must be recognized by the computer's system and listed for example by the command line tool
lsusb
orlspci
. You get more details with the verbose optionThe drive must also be recognized as a mass storage device for example by the command line tool
lsblk
. The two command linesshould list the drive in a way, so that you can identify it. The following command line is even better, because it lists also the model (which typically includes the brand name and/or model of a pendrive or a card adapter).
(You can copy and paste from here to a terminal window in order to avoid typing errors.)
Looking at a persistent live drive
/dev/sdd
and a cloned live-only drive/dev/sde
can produce the following output,A memory card plugged into an internal slot may be recognized as
/dev/mmcblk0
as illustrated by the following example, where an Intel NUC is booted from a microSD card in an adapter in the SD card slot,In this case, no model name is listed. You can probably be convinced, that you are 'looking at' the card anyway, but there are other tools, that can help you identify the card,
parted
andlspci
,Let us hope that there is 'only' confusion
Try to restore the drive to a standard storage device
Install and use mkusb (mkusb-dus), which can format alias restore a drive to a standard storage device (with an MSDOS partition table and a partition with the FAT32 file system). These instructions are relevant for many kinds of drives (USB pendrives, memory cards, hard disk drives, HDD, solid state drives, SSD), but probably most often used for USB pendrives and memory cards.
If you run standard Ubuntu, you may need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)
See these links with more detailed instructions,
mkUSB-quick-start-manual.pdf or if the link does not work, this alternate link
help.ubuntu.com/community/mkusb
mkusb version 12 alias mkusb-dus:
mkusb wipes the first megabyte as a first step of restoring it
Sometimes some data are 'tricking' the software to think that the drive does not work, even when it is good, and it is enough to wipe the first megabyte to get rid of those data. You may 'look at' the drive with a tool, that does not recognize or understand correctly the structure of the partition table or a system, for example
So you can
What to do if mkusb fails
If mkusb fails, the drive is either not found by the system or read-only. In this case you should try according to the list in the paragraph 'The drive is read-only' (above).