0

So, my phone has this error (it turns off randomly), and because of that, my 32GB microsd card got corrupted. Is there any way to fix de microsd card or recover the data on it?

I put the sd card on the pc through an USB adapter, and it only shows 32MB:

I put the sd card on the pc through an USB adapter, and it only shows 32MB

I tried CHKDSK command on windows but it didn't work.

5
  • What does it show for the SD card in GParted?
    – fakedad
    Oct 31, 2016 at 22:23
  • try this answer unix.stackexchange.com/a/31902 but be careful with dd command. if you enter /dev/sda instead of /dev/sdb of sdac, the hard disk is going to get erased.
    – red artist
    Oct 31, 2016 at 22:39
  • Please post the output of sudo lsblk and sudo fdisk -l. Oct 31, 2016 at 22:47
  • 1
    @saikiranreddy that will completely erase the disk. Not what the OP is looking for.
    – user595510
    Oct 31, 2016 at 23:46
  • @Zacharee1 but doesn't he want his data
    – user595510
    Nov 18, 2016 at 13:24

3 Answers 3

3

First things first:

If you want your data. DON'T do any writing to the card as you try the rescue.

I just happened to have the same problem on a friends PC with an external HDD which got its volume entries corrupted and was also only showing a few MB instead of 60 GB. This happened because he did not safely remove the drive from his PC. If your card is really broken then nothing except a professional rescue service will be of any help to get your data.

Step 1: open a terminal window

Simply press ctrl+alt+t to open a terminal window.

Step 2: acquire testdisk

testdisk is available in the normal Ubuntu repositories so simply install it by:

sudo apt-get install testdisk

Step 3: rescuing your data via testdisk

Insert your SD-card into your card-reader or plug in the drive you want to rescue and fire up teskdisk with:

sudo testdisk

Then you will see the following in your terminal window:

testdisk main screen

Here you can choose to create a log file which I highly recommend for eventual troubleshooting. Simply press enter and you will see the next in your terminal, where you can choose the drive you want to rescue:

testdisk drive selcetion

Of course you see my drives in the screen-shot so you have to navigate to the corresponding drive with the up and down arrow key and then select at the bottom proceed with the left and right arrow key and hit return.

Next you will see is the file-system selection like in the next screen-shot:

testdisk file system selection

In most cases it tells you in the hint at the bottom which file-system type to select, do so or set it to the corresponding type of your drive. Then hit return again to proceed.

In the next menu (see screen-shot) select 'Advanced' and you should be able to see the full partitions (maybe a second partition on your card). Select it and select 'List' files and back them up.

testdisk rescue options

You should then see the directory structure you had on your drive like in the next screen-shot:

testdisk directory listing

See the red ones on the screen-shot; these are deleted files you can choose to hide by pressing h. Now navigate to the files/directories you want to rescue by pressing up and down arrow key (you can switch directories with enter or go upward by selecting the .. entries.

To make a selection of which files you want to copy/rescue press : which will mark the corresponding row green or press c to copy a single file. For copying the selection press shift+c. In both cases you will then be prompted with another directory view where you can navigate to a place to save your data/files. Navigate to where you want to have this data and press shift+c again to start copying.

Step 4: cleaning your SD-card

After you have all your data rescued its time to clean up the SD-card so you can use it again to full capacity. To do this just enter the following in your terminal (make sure you select the right volume for your card which was sdb in your screen-shot so I take that for my example here)

sudo dd bs=4m if=/dev/zero of=/dev/sdb

This may take a while to run but after that there is nothing on the SD-card at all so you should be able to use it with your reader and simply format it again.

2
  • dd: invalid number: ‘4m’
    – Rafay Khan
    Jun 29, 2020 at 10:46
  • @RafayKhan: Try using 4M instead, it can be that they changed this to uppercase for blocksize in Megabytes, sadly have no computer at hand right now to test.
    – Videonauth
    Jun 29, 2020 at 11:12
1

When the SD card was formatted for file storage, a small portion was reserved for configuration files. That small portion is the 32 mb empty space that you can see there. I don't have enough info on your problem, but it sounds like you have a problem similar to this HowToGeek article. The Raspberry Pi in said article has the same issue as you. To quote from the article,

When I went to reformat the card only 64MB out of the original capacity was available and even when I went into Disk Management in Windows the best I could do is dump the contents of the inaccessible (and presumably Linux-filled) partition. This left me with a tiny Windows accessible partition and a big phantom partition I can’t do anything with.

I should assume that you are using Windows to view your card's files on the SD reader. If so, then it is more than likely that your missing 32 GB of space is a Linux-formatted partition, which Windows cannot see. If that is case, you can get an Ubuntu LiveCD, boot it up on your computer, run the LiveCD without installing, and transfer the files to your Windows machine. Then, you can reformat the SD card, while still in the LiveCD.

Hope it helps!

~ P

1
  • 1
    but he is using Ubuntu, i thought
    – user595510
    Nov 18, 2016 at 13:24
0

If the SD card claims that it's only 32 GB large then there's nothing you can do about that with software alone – Ubuntu/Linux or any other operating system.

If you need the data that might still be on the card contact a professional data rescue company who might be able to inspect the memory modules on the SD card without having to rely on the (apparently faulty) memory controller chip on the card.

If you don't care about the data and just want a working 32-GB SD cards, please edit your question to clarify that. There's also a comment to your question with a link dealing with that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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