fixing a corrupted SD card in linux My phone is a HTC Desire (model Bravo) and I previously rooted it (using tacoroot and revolutionary) and had the clockworkmod recovery (5.8.0.2) on it as well as the liquidsmooth v3.2 rom for the Desire.

I formatted the SD card in clockworkmod, choosing 2G for the extended partition and 128M cache. This still works after flashing CWM: advanced -> Partition SD Card -> Ext Size 2048M -> Swap Size 128M returns the happy message

Partitioning SD Card... please wait...
Done!


But then with the new ROM when I tested the camera, it said that there was no SD card present.

So I went back to the recovery and re-partitioned the SD card with different sizes (not sure how to go back to the original setting). Clockworkmod said that the re-partitioning was successful.

But after that first re-partitioning the SD card has not been accessible. This also means that I cannot install a new ROM (the browser invariably crashes in LiquidSmooth).

I have now installed the -very user friendly!- TeamWinRecovery version 2.3.1.1 to try and re-format or re-partition the sd card, but it says E: unable to mount /sdcard and E:EXT + Swap size is larger than sdcard size. That is not right because the card is 16G.

The following Linux command tell me that the phone is connecting with my computer:

$ fastboot devices -l    # during boot loader
SH07XPL04124             fastboot usb:2-1.1


Sometimes (but not always) when I attach the phone to the computer, I get the dmesg lines 

[2076992.175291] usb 2-1.1: new high-speed USB device number 70 using ehci_hcd
[2076992.280434] usb 2-1.1: New USB device found, idVendor=0bb4, idProduct=0c87
[2076992.280442] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2076992.280448] usb 2-1.1: Product: Android Phone
[2076992.280452] usb 2-1.1: Manufacturer: HTC
[2076992.280456] usb 2-1.1: SerialNumber: SH07XPL04124
[2076992.284078] scsi168 : usb-storage 2-1.1:1.0
[2076993.285389] scsi 168:0:0:0: Direct-Access     HTC      Desire           0100 PQ: 0 ANSI: 2
[2076993.287105] sd 168:0:0:0: Attached scsi generic sg3 type 0
[2076993.295416] sd 168:0:0:0: [sdc] Attached SCSI removable disk


And in the File Manager (PCManFM 0.9.10) the device shows up as 'HTC Desire'. Clicking on it gives no result though -- the program asks which application should be used to open this file.

Following the dmesg lines, the command gparted /dev/sdc results in

Error opening /dev/sdc: No medium found


During the recovery session, I can adb shell but nothing is listed in /proc/filesystem or /proc devices. With lsusb I get 

Bus 002 Device 083: ID 0bb4:0c87 HTC (High Tech Computer Corp.) Desire (debug)


During fastboot, adb shell returns an error.

On the phone, in the TWR file manager, I can go to the directories /sdcard (which contains a directory /sdcard/TWRP with a file .twrps) and /sd-ext (which is empty). Using adb shell I can also delete /sdcard and /sd-ext --it turns out they are just directories created during the mounting attempts. Trying to mount them again re-creates the directories but also says:

E:Unable to mount storage
E:Unable to mount '/sdcard'


I just cannot partition or format the sd card to a usable state again.

My suspicion is that the previous partitioning in CWM causes it to mount as a system directory (or something like that) so that it is not available any more for mounting as external storage.

Does that make sense?

And has anyone an idea how to solve this?
Well, that one is solved!

The problem was not the SD cards, but the fact that rooting etc. the Desire caused it to USB-brick. Never heard that before.

As Spezi77 advises in the presentation of his CM11-for-Desire link, I switched to the 4ext recovery, which has a special USB-unbrick function. Some sources also name fastboot commands that should do the same, but they did not work for me.

Long story short, I'm running Spezi77's version of CM11 on my Desire now!