I have two PCs and one micro SD card. What I did was copy some files (1.1 GB) onto micro SD card. But I replaced some files. So everything was perfect, until I tried to use the SD card for Raspberry Pi, when did not work.

I checked the micro SD card again, and most files had disappeared! I connected it to my mac and formatted the micro SD card. It was good for mac but not Ubuntu. It said that 1.1 GB is used! But there are no files.

I re-formatted again, but this time in Ubuntu. And now the total capacity has dropped, and it is unreadable in mac.

Why has this happened? Is there any hope that I can fix it?

marked as duplicate by sudodus, karel, Fabby, Zanna, David Foerster Apr 10 '18 at 12:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


The explanation is based on my experience and knowledge : Crossing portable storage solution from different architecture/OS may corrupt the partition table. A corrupted partition table can prevent from using the existing partition or creating new working partition.

Solution with ubuntu computer :

Insert SD card in the computer and open a terminal


Find the sdcard in the output. Unmount any mounted filesystem, for example:

udisksctl unmount -b /dev/mmcblk0p1
sudo apt-get install parted
sudo parted
(parted) select /dev/mmcblk0
(parted) print
(parted) mktable msdos
(parted) mkpart primary fat32 1 31300

The last number depends on your SD card. To know that number you need to look at the second line of the print information. mine was 31.3GB so I entered 31300 which is in MB. It is up to you to find this information or to write back here.

(parted) print
(parted) quit
mkfs.fat /dev/mmcblk0p1

You should have a working SD card now.

Some notes on the commands:

  • (parted) means that you are still in the parted utilty.
  • /dev/mmcblk0 is a guess since it can vary from a system to another. Use the correct label for your sdcard
  • Be careful to carefully select the right device with parted. If you are not sure that you are selecting the right one come back here and ask.

Not the answer you're looking for? Browse other questions tagged or ask your own question.