tactical vim

nerdy bits & pieces

fix your G1 Android messed up SD card

with 4 comments

I recently purchased one of the new T-Mobile G1 Android phones, and not a few hours had passed and I had run into a brick wall – the SD card would not mount on my Linux laptop, I was getting all sorts of random read errors. A little Googling showed me I wasn’t alone, it appears many, many people have gotten SD cards with their G1 having the same type of issue. Here’s how you can fix it with a card reader (not the phone), any linux distro and ‘parted’ partitioning tool.

The below looks difficult and long, but in reality it takes all of 5 minutes to fix. It’s taken me longer to write this out than it did to do the actual process – I’m writing it from memory in fact. I did the below to two different SD cards that were failing to function properly and now they’re fine.

NOTE: please, be sure you’re working on the SD card and not your hard drive, mmmk?

Step 1: power off the phone and remove the microSD card from the slot. Now insert this microSD chip into one of the larger SD cards (this did not come with the phone – I have a bunch of these from other microSD cards, if you don’t have one I’m sure one of your coworkers does).

Step 2: insert the SD card into a reader, and if you’re lucky it will mount fine – mine did. This allowed me to copy off all the pre-loaded content that T-Mobile had given me, but really isn’t that important. If the card doesn’t mount then you really can’t do this part. Make sure to unmount the card before proceeding.

Step 3: figure out the linux block device name of your card; this will depend on the card reader you have – there is no one name I can give you. In my case I was using a builtin reader in the laptop, the device was /dev/mmcblk0p1 – in many cases it will show up as a scsi disk such as /dev/sdc or something. How you get this info easily is one of two ways — if the card mounted, then just type “df -h” and it’s listed right there. If it didn’t mount in the above step, then look at /var/log/messages to get the name the linux kernel gave to this device.

Step 4: start ‘parted’ with the name of this device *without* the partition name. If the ‘df -h’ above gave you /dev/sdc1, then you remove the ’1′ (partition) and the device itself is /dev/sdc. In my case, the system put a “p1″ on the end which I removed which left me with /dev/mmcblk0. I started parted then like so:

    parted /dev/mmcblk0

Step 5: after ensuring you’re actually using the SD card (check the output, type ‘print’ to be sure, whatever — just don’t go screwing with your computer’s hard drive OK? :) ) type the command “mklabel”. The parted tool will warn you that you are about to destroy the content, say Yes. Then it will ask you for the name of the label – type “msdos” as that is the proper answer for this SD card.

Step 6: type “print” to show the partition table (it will be blank), what you’re looking for is the size of the card as parted sees it. This is a line that looks like:

    Disk /dev/mmcblk0: 2045MB

Step 7: type the appropriate ‘mkpartfs’ command using the above disk size to make it one single big fat16 partition, like so:

    mkpartfs primary fat16 0 2045MB

Tip: type “print” again and it should show one partition taking the whole disk.

NOTE: if your SD card is larger than 4GB use fat32 above instead of fat16. The FAT16 format can only handle up to 4GB (w/ Windows NT/2000/XP/+) for technical reasons; you will need to use fat32 on larger 8GB/16GB/etc. SD cards.

Step 8: type “quit” to leave parted.

Step 9: type “mkfs.vfat /dev/mmcblk0p1″ (or /dev/sdc1, or whatever the proper device name is of your block device and partition you just made) to quickly make the filesystem on it.

Step 10: mount the SD card (just take it out and stick it back in in most modern Linux like Fedora or Ubuntu) and copy the old content back onto the card, if needed.

Now you can stick that card back into your phone and it will work correctly for not only mounting as an SD card with your Mac/PC, but also the forced updating and other tricks that seemed to have failed will (or should) now work. The basic problem is the SD cards are being made without a proper partition table, and this seems to have some sort of off effect with the Android OS.

2008-11-13: If anything is unclear, please feel free to leave a comment – I see a lot of people are making their way to this post from various websites and Google searches, the problem is widespread. Feel free to pass on this info to other G1 Android sites, let’s get the knowledge out there and circulating.

Written by troyengel

2008-11-11 at 14:57

Posted in Uncategorized

Tagged with , , , , , , ,

4 Responses

Subscribe to comments with RSS.

  1. Sorry,but I didn’t understand any of this! I had backed up my first G1 to the SD card. When I installed to the new G1 it said it couldn’t read it. Have tried 2 more SD cards. At first they work and then they don’t. I’m lost!

    Keith

    2010-09-03 at 15:29

  2. Nerdy Bits,

    I have the same issue as Keith mentioned – cannot understand the instructions (and is this on a Windows XP/Vista, or are you running Linux?). If it is for a PC running Windows, its not to clear …would you post another instructions?

    ISSUE: Got a new Nexus G1 on warranty (phone, when got hot in car dock keyboard became unuseable….hit “t” I would get “m” and so on….anyway, I got a New Phone.

    I had backed up with several systems == to my PC, online with Lookout, and BackUp Pro. But then the SD card (same one in the original car) was put in the new G1, it crashed and wiped it clean (did this to another card too).

    SO I am TRYING to restore but the card is completely clean – nothing on it and I did NOT reformat (wanted to restore from SD Card but that seems impossible) so I need to go to the PC and the backup there.

    Any Ideas?

    Murph

    2010-10-04 at 11:09

  3. Hi, I’m trying to do backup on my new 16GB SD but doesn’t work! I tryed many different things and I read different random errors.
    I don’t think that this application works fine on Samsung Galaxy S.

    I’d like have back my money!

    Fabio

    2011-03-05 at 06:48

  4. this is on linux. if you dont understand these instructions, leave here and run far far away…..

    kevinlc77

    2011-10-04 at 20:57


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 65 other followers

%d bloggers like this: