Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Sunday, May 13, 2012

Android: "Damaged SD card", how i lost my data but reclaimed my SD card (needs root)

Firstly: If you have this problem, contact your retailer or service point!

The story/instructions below are totally unsupported and requires expert knowledge!

My SD card was "damaged" according to Android (4.0.4) running on a HTC Desire S.
Mounting it from the Android menus didn't work at all. Since I didn't care about the data on the SD card I tried to reformat it from Linux but failed. This is how I managed to get the card to work again (though with my data LOST).

The instructions below erases ALL data on our SD card. I am not responsible for loss of data or any other damage to your Phone or SD card!


My phone was using a pre-rooted version of Android with busybox installed, and this is considered a requirement to do the steps below.


* Connect your phone to your computer using Android Debug Bridge (adb) from the Android SDK
* Find out which volume that is representing our SD card by starting logcat (adb logcat) and look at the screen printout while clicking on "Mount SD card" in the "Storage" menu on your Android phone. On mine it was /dev/block/vold/179:65
* Start an adb shell, (adb shell)
* Run fsck on your disk: fsck_msdos /dev/block/vold/179\:65
* Fsck will probably report errors, mine reported exit code 8. If fsck asks if it can try to repair you could try that, it didn't work for me though.
* If the fsck repair failed we are now sure that the card is not possible to rescue. Let's reformat.
* Still in the adb shell, run: mkfs.vfat /dev/block/vold/179\:65 (replace the device name with the name corresponding to your device from previous steps)
* mkfs doesn't output anything if it completed successfully. To make sure our volume/disk/card is OK we run fsck_msdos again fsck_msdos /dev/block/vold/179\:65
* fsck_msdos should report no errors
* Trying to remount the card again in Android should now hopefully work: Settings->Storage->Mount SD card

Again: These steps will erase your SD card completely and all your data will be LOST! I am not responsible for any data loss or damaged cards/phones! The methods above are totally unsupported and if in doubt, contact your retailer or service point!

Thursday, March 22, 2012

Android: Copying SD cards

Switching SD cards in your phone and copying the contents of the old to the new one can cause trouble if permissions aren't right. This usually happens if your "middle man"  is not using FAT file system. This is how I solved it (note; using 775 permissions can cause security issues!).

* Mount the SD card on a Linux machine through our phone or using a card reader.
* Copy the contents of the SD card to a temporary location on your machine
* Set permissions (recursively) to 775 (rwxrwxr-x) on the contents (chmod -R 775 /tmp/sdcard)
* Unmount SD card and mount the new one
* Copy the contents from the machine to the new SD card
* Unmount the SD card

Couple of tips:
* Don't switch SD cards while Android is running, especially not if you have apps or app data on the SD card
* ClockworkMod can mount the SD card as USB storage
* If you have CWM backups, try and open the "Restore" after the copy procedure. If your backups are listed your SD card is most probably good to use
* Again, don't switch SD cards when Android is running

Following these steps a 2GB card was successfully replaced with a 16GB without any application issues.

I am not responsible for any loss of data or damaged SD cards or phones.

Thursday, July 7, 2011

Android: Replacing keyboard

When trying to replace the current keyboard on an Android installation, don't forget to push the lib file related to the keyboard.
Example (Replacing the "Gingerbread" keyboard in the Ginger Stir Fry ROM with the CM7 keyboard):
Removing
* adb shell rm /system/app/LatinIME.apk
* adb shell rm /system/lib/libjni_latinime_moo.so
* adb uninstall com.moo.android.inputmethod.latin.free

Installing (current directory has the CM7 keyboard files)
* adb install LatinIME.apk
* adb push libjni_latinime.so /system/lib/

Note! If you have problems with remount, that is; you can perform the remount command but while trying to remove a file the system says the file-system is read-only. Try to enable and disable "Debugging" on the phone a couple of times and then try to remount and remove again.