Bootloop after CM install. Won't restore backup, mount /data, flash stock - Sony Xperia ZR

Hi developers. I am sorry for posting this. I spent the last week trying to solve it by myself with no hope. This is my second time installing something on a phone, but it is my only phone, so I beg anyone for a help...
-What I did:
Some days ago I downgraded to this ROM C5503_10.1.1.A.1.310_GLOBAL-LTE.ftf to use DoomLord rooting script. I did it with flashtool for linux and I applied his .bat step by step in the terminal since windows would not detect my phone.
It worked. I had root for some days, but I was still annoyed by sony default android. So I decided to install Cyanogenmod.
I unlocked the device with sony official system and wen't straight to this instructions, before the first reboot
wiki.cyanogenmod.org/w/Install_CM_for_yuga
I booted succesfully in CWM, followed everything as it says there. But that's where weird things happened:
-The problems:
-The backup
I tried, it wouldn't mount /sdcard. Since I don't understand much about this, I thought it was normal. The next choice was sdcard1, I backed up there. Or so I thought...
-The factory reset
I factory reset, again, not mounting sdcard. Here is the message that shows when I try this now:
can't mount /data!
Error mounting /sdcard.android_secure
Skipping format...
Data wipe complete.
Since it said it is complete, I went on installing the zip file from my sdcard1. Both CM 10.2.1 (dogo, the right one for my phone) and the appropriate GAPPS.
Now it loops on the CM loop animation and I have to remove the battery...
-The restore problem
It still boots on the recovery mode. So I tried recovering my backup from sdcard1. But the image name is 1970.01.01.00.03.16. And it says "md5 mismatch"
I tried flashing again the stock rom with flashtool. The proccess goes on but nothing happens. I still have CWM and the boot loop.
I read elsewhere someone with a similar problem who solved using sony "emma" software. I installed it, it won't even recocnize my phone.
It recocnizes that there is a phone, but don't know which one.
But that has alway been the case with windows. I haven't been able to do anything in windows other then accessing the sdcard (when the phone worked).
Is there something I can do? I imagine that somehow, for some reason, the /data and /sdcard partitions got corrupted. I imagine I would need to repartition this and install again, but I have no idea how this happens on phones...
I can mount /system /cache and /storage/sdcard1. just /data I can´t. Says "error mounting /data"
This is my only phone and a vey recent $400 thing. I was very stupid to do that withouth a replacement and really need this phone. I greatly appreciate any help...

I found this post forum.cyanogenmod.com/topic/6433-solved-messed-up-partitions-on-internal-storage/ searching the internet. Is it possible that this would solve my problem? or would it finish bricking the phone?
Here's what you'll need:
Working recovery, basic knowledge of adb & the shell
Parted (download here)
stock PB31IMG.zip
Note also that I had run unrevoked forever (so my phone was S-OFF) ... I'm not sure if that's required or not.
So, grab parted from the link above. Now you need to extract the individual binaries from the .zip (the 6 files in the sdparted folder within the zip), ideally to your android-sdk\tools directory. Now push all 6 files (adb push [file] /sbin/). Next, we need to make them useable, so go into the shell (adb shell). Change to your /sbin/ directory, and run: chmod 0755 <file> on each of the 6 files.
Now, we need to fix the partitions. This is assuming that the partitions are there, just the wrong format (which is what happened to me .. I accidentally made them FAT32 instead of ext). So, run the following: parted /dev/block/mmcblk0 mkfs ext2. It will ask if you want to continue, hit yes. When it asks for the partition number, enter 1. Next, when it asks for the format, enter ext2. Let it do its thing. Now, once it's done, run parted again. This time, enter partition 2 (everything else is the same).
Click to expand...
Click to collapse

Related

Clockwork Recovery?

Hi,
I was curious if there is any way to replace the recovery with CWR (or something similar)? I would like to tinker, but i always feel better about having a backup in case something goes wrong.
Thanks,
Rich
while it is quite impressive that we have things such as angry birds and launcherpro, we dont seem to even have a system dump. i would think that a system dump would be required in order to better understand the rest of the system, including the nook launcher itself. then we could go after a recovery and custom roms. but i think it wont be long. like a week or two, it didnt take long to root it from initial release.
I would assume someone has noticed this, since it seems obvious, but I'll point it out just in case.
Partition 3 is an ext2 partition, which I mounted temporarily. On there are a few recovery files, including factory.zip, which appears to be a full firmware backup. What's puzzling is that factory.zip does NOT seem to be applied when I do a factory reset via Home+Vol Up, as my installed apps on /system are still there (and factory.zip has a script to format and rewrite the system partition).
So....anyone have ideas for how to trigger an update from this zip? It's not as nice as clockwork recovery, but at least we would be able to mess around and restore to factory easily.
clockworx said:
I would assume someone has noticed this, since it seems obvious, but I'll point it out just in case.
Partition 3 is an ext2 partition, which I mounted temporarily. On there are a few recovery files, including factory.zip, which appears to be a full firmware backup. What's puzzling is that factory.zip does NOT seem to be applied when I do a factory reset via Home+Vol Up, as my installed apps on /system are still there (and factory.zip has a script to format and rewrite the system partition).
So....anyone have ideas for how to trigger an update from this zip? It's not as nice as clockwork recovery, but at least we would be able to mess around and restore to factory easily.
Click to expand...
Click to collapse
try to strings the u-boot.bin that's in that partition (or in p1). The u-boot environment variables are in there. When one of the recovery modes are triggered, a file called BCB is written with a string presumably instructing recovery on what to do. It's a little hard to follow since the envs have to write the string into memory and call fatsave to save the string into the file.
Here's what I can see is happening:
-up+home recovery writes "boot-recovery recovery --wipe-data-ui"
-some condition (dead battery + charger just plugged in?) writes "boot-recovery --update-package=BOOT:charging.zip"
-too many reboots (looks like >7) without devconf/BootCnt being written with 0 (don't know where this happens) writes "boot-recovery recovery --update_package=MISC:factory.zip"
If you were daring you could probably mount partition 2 and echo 8>devconf/BootCnt and I'd imagine it would force a complete factory.zip install.
edit: BootCnt seems to be binary valued, though ASCII '8' should still trigger it.
-if devconf/DeviceID doesn't exist (this is a copy of the serial number file) then it writes "boot-recovery recovery --update-package=BOOT:romrestore.zip". No ideas about this one.
-finally, if a plain FAT microSD is found with the file "encore_update.zip" then it writes "boot-recovery recovery --update_package=SDCARD:encore_update.zip". Guess how we'll get non-OTA upgrades?
Haha, I was just searching for the string .zip in the recovery binary. I found that, and googled "encore_binary.zip", and here I am again, full circle.
I'm guessing encore_binary.zip only gets flashed from VolUp+Home recovery, right?
I copied factory.zip to my SD and renamed it encore_binary.zip, just to try...Couldn't get it to activate, unfortunately.
clockworx said:
Haha, I was just searching for the string .zip in the recovery binary. I found that, and googled "encore_binary.zip", and here I am again, full circle.
I'm guessing encore_binary.zip only gets flashed from VolUp+Home recovery, right?
I copied factory.zip to my SD and renamed it encore_binary.zip, just to try...Couldn't get it to activate, unfortunately.
Click to expand...
Click to collapse
I've got one better for you:
I tried what I recommended about /rom/devconf/BootCnt and got the "Installing..." screen. Then a boot loop running through the installer over and over.
Then I broke in by putting a Nooter card in the slot. It seems that u-boot uses itest.l to test the boot count, where .l is for long and we wrote just one byte leaving whatever was in the remaining 3 bytes of ram to stick around. Why it bootloops I don't know. So in Nooter I mounted /dev/mmcblk1p2 /mnt then "echo -n -e "\000\000\000\000" > /mnt/devconf/BootCnt", removed the card, and rebooted. No more boot loop!
Then for the lulz: On my PC I did "echo -n -e "\008\000\000\000 > /tmp/foo" and "adb push /tmp/foo /rom/devconf/BootCnt; adb reboot". This (writing a (long)8 ) forced the reboot into recovery and then booted normally when done. After doing this, I noticed that adb is enabled (/data left alone), my user partition untouched, but my root is gone (ramdisk overwritten) and /system was wiped.
So if you wanted to remove all traces of your rooting, use the above to force recovery, then use up+home to force factory reset. The next question (which I'm too much of a wuss to explore) is if the recovery or factory reset will rebuild trashed /system or /data filesystems.
pokey9000 said:
I've got one better for you:
I tried what I recommended about /rom/devconf/BootCnt and got the "Installing..." screen. Then a boot loop running through the installer over and over.
Then I broke in by putting a Nooter card in the slot. It seems that u-boot uses itest.l to test the boot count, where .l is for long and we wrote just one byte leaving whatever was in the remaining 3 bytes of ram to stick around. Why it bootloops I don't know. So in Nooter I mounted /dev/mmcblk1p2 /mnt then "echo -n -e "\000\000\000\000" > /mnt/devconf/BootCnt", removed the card, and rebooted. No more boot loop!
Then for the lulz: On my PC I did "echo -n -e "\008\000\000\000 > /tmp/foo" and "adb push /tmp/foo /rom/devconf/BootCnt; adb reboot". This (writing a (long)8 ) forced the reboot into recovery and then booted normally when done. After doing this, I noticed that adb is enabled (/data left alone), my user partition untouched, but my root is gone (ramdisk overwritten) and /system was wiped.
So if you wanted to remove all traces of your rooting, use the above to force recovery, then use up+home to force factory reset. The next question (which I'm too much of a wuss to explore) is if the recovery or factory reset will rebuild trashed /system or /data filesystems.
Click to expand...
Click to collapse
Actually, factory.zip touches data, but all it does is kill packages.xml and wipe the dalvike cache.
Also, the factory.zip script will reformat mmcblk0p5, so it fixes it in that sense, but I doubt it could recover if you started killing partition layouts and stuff like that.
I was just looking through the updater-script in factory.zip and I noticed this:
Code:
mount("vfat", "/dev/block/mmcblk0p1", "/boot");
I just thought it was interesting that mmcblk0p1 is type vfat.
staulkor said:
I was just looking through the updater-script in factory.zip and I noticed this:
Code:
mount("vfat", "/dev/block/mmcblk0p1", "/boot");
I just thought it was interesting that mmcblk0p1 is type vfat.
Click to expand...
Click to collapse
It has to be, otherwise the OMAP won't find the bootloader.
clockworx said:
Actually, factory.zip touches data, but all it does is kill packages.xml and wipe the dalvike cache.
Also, the factory.zip script will reformat mmcblk0p5, so it fixes it in that sense, but I doubt it could recover if you started killing partition layouts and stuff like that.
Click to expand...
Click to collapse
I've been messing around with the monster root pack, and can confirm that doing a "Erase and Deregister" doesn't clean out the system; I was still at least half-rooted and nearly unusable. I wiped the transient partitions from CWR and then the eight-boots reset got me back to (what I think is) stock.
I re-applied the monster pack and am having stability issues, but that's another thread, somewhere, I hope...
Dennis
stolenmoment said:
I've been messing around with the monster root pack, and can confirm that doing a "Erase and Deregister" doesn't clean out the system; I was still at least half-rooted and nearly unusable. I wiped the transient partitions from CWR and then the eight-boots reset got me back to (what I think is) stock.
I re-applied the monster pack and am having stability issues, but that's another thread, somewhere, I hope...
Dennis
Click to expand...
Click to collapse
The only thing that actually fully restored a rooted (via auto-nooter) NC to stock for me besides using clockwork recovery to overwrite the sys, data and boot partitions is the 3 finger salute - power on while holding down N and Vol+. I manually erased the internal memory just in case auto-nooter put junk on there as well.
Stability issues here too. Can't decide whether to go back to stock, cm7 emmc or stock and sd cm7.

[Q] HELP! Maybe brick?

I was trying to fix my NC and install the 1.0.1 firmware. So I tried to format everything back to factory setting so I went into clockwork mod recovery and thought formatting the system partitions would restore me back to factory settings. Well I formatted "boot" and now it will not boot.
tl;dr I formatted boot, is it bricked?
help?
wolffboy212 said:
I was trying to fix my NC and install the 1.0.1 firmware. So I tried to format everything back to factory setting so I went into clockwork mod recovery and thought formatting the system partitions would restore me back to factory settings. Well I formatted "boot" and now it will not boot.
tl;dr I formatted boot, is it bricked?
help?
Click to expand...
Click to collapse
http://nookdevs.com/Flash_back_to_clean_stock_ROM
Do "Method one: Eight interrupted Boots" and post what happens afterwards
As I understand it, it is not bricked. You need to go read both the Nookie Froyo thread and the Clockwork Thread in the Nook Color Development Subforum. There is a way to put Nookie Froyo on an sdcard. You then boot with that and there's a way to put stuff back on the NC.
Do you have a Clockwork backup?
If you can boot back into Clockwork, there are some copies of other folks nandroid backup available. You can then put that on your sdcard and restore it.
I don't have the exact answer for you, but I'm sure it can be fixed.
Geezer Squid said:
As I understand it, it is not bricked. You need to go read both the Nookie Froyo thread and the Clockwork Thread in the Nook Color Development Subforum. There is a way to put Nookie Froyo on an sdcard. You then boot with that and there's a way to put stuff back on the NC.
Do you have a Clockwork backup?
If you can boot back into Clockwork, there are some copies of other folks nandroid backup available. You can then put that on your sdcard and restore it.
I don't have the exact answer for you, but I'm sure it can be fixed.
Click to expand...
Click to collapse
Paul22000 said:
Do "Method one: Eight interrupted Boots" and post what happens afterwards
Click to expand...
Click to collapse
When I press the power button nothing happens. I.E. screen stays black. Would your guy's ideas work if you can boot at all?
wolffboy212 said:
When I press the power button nothing happens. I.E. screen stays black. Would your guy's ideas work if you can boot at all?
Click to expand...
Click to collapse
I had the same thing happen. I tried plugging it into my Macbook, but nothing happened. I plugged into my Windows PC, and it came back to life.
A nookie froyo SD card would work fine. Restore from there manually. Next time make a nandroid and do not delete things that you do not know...
Syco54645 said:
A nookie froyo SD card would work fine. Restore from there manually. Next time make a nandroid and do not delete things that you do not know...
Click to expand...
Click to collapse
i have a nandroid back up and i cant get into recovery mode.
Because you deleted boot. Use a nookie froyo SD card and put the contents of boot back manually.
wolffboy212 said:
i have a nandroid back up and i cant get into recovery mode.
Click to expand...
Click to collapse
Which button combo are you trying to use to boot into recovery mode? If you haven't already, make sure you're using the three-button method.
Sent from my Nooted friend...
I have gotten it to boot to froyo on my sd card.
Now I need help restoring the boot partition from there.
Thank you very much with the support so far
It is not three buttons. Only need home and power.
wolffboy212 said:
I have gotten it to boot to froyo on my sd card.
Now I need help restoring the boot partition from there.
Thank you very much with the support so far
Click to expand...
Click to collapse
I am not certain what to do exactly as I have never used nookie froyo. Generally you are going to want to do
modified /system/boot
mount -t vfat /dev/block/mmcblk0p1
then put the files back in there from in nookie froyo.
Someone else may have the exact way. Sorry I cannot be of more help but that will mount boot when in stock. Of course you will have to mount system as RW as well.
Syco54645 said:
I am not certain what to do exactly as I have never used nookie froyo. Generally you are going to want to do
modified /system/boot
mount -t vfat /dev/block/mmcblk0p1
then put the files back in there from in nookie froyo.
Someone else may have the exact way. Sorry I cannot be of more help but that will mount boot when in stock. Of course you will have to mount system as RW as well.
Click to expand...
Click to collapse
Bare with me I know very basic unix and linux commands but I do have the brain capacity to figure things out (not boot partitions).
I was on the command line and I couldn't get into the nook color stuff just the nookie froyo stuff on the sdcard.
suggestions?
Please read CW recovery thread. All answers are in there!
Really, please take time to browse through existing threads before posting questions which have already been answered several times.
Anyway, considering the number of people asking, here goes:
Note: You can do all this from the Nook, without the need of ADB, except for the fact that you will need gapps on nookie in order to install terminal and root explorer (although you could install those apps by directly installing APK's), see http://nookdevs.com/NookColor:_Nookie_Froyo_Tips, Third-party app support
Please read entire thread before attempting anything!
- Boot into nookie with market installed.
- Install terminal emulator.
- Install root explorer
- Create a new folder at root (/), for example "boottmp" => "/boottmp"
- Launch terminal emulator
- type: "su"
- type: "mount /dev/block/mmcblk0p1 /boottmp"
- type: "echo -n -e "\x08\x00\x00\x00" > /rom/devconf/BootCnt" (this will force reset on next boot, as if you did 8 failed boots)
- open browser
- Download boot.zip from here: http://forum.xda-developers.com/showpost.php?p=10470539&postcount=268
- copy zip content to "/boottmp", by replacing existing files
- shutdown
- remove sdcard
- power up, you should see installation process after splash screen. Wait for it to finish, and it will reboot.
- power off
- Next you need to reset to factory settings:
- Boot while using power button and N button. Should boot to menu allowing reset. Proceed with reset.
Boot and be happy.
OR,
If you're able to access ADB (available when booting CW recovery and mounting /system and /SDcard, format from android required on SD to work here), CREDIT GOES TO Duloz, try this:
adb push uRecRam.bak /sdcard/
adb shell
su
mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
mkdir /system/boot/
mount -t vfat /dev/block/mmcblk0p1 /system/boot
cat /sdcard/uRecRam.bak > /system/boot/uRecRam
umount /system/boot
rmdir /system/boot
Click to expand...
Click to collapse
Note: Don't worry about errors concerning unmount.
If you're not back in business, post your questions, being very clear about what worked and what didn't.
Thank you.
Sent from my HTC Desire using XDA App
Back from Clockwork Recovery to Virgin (Factory) Recovery ... works like a charm!
samuelhalff said:
Please read CW recovery thread.
- Boot into nookie with market installed.
- Install terminal emulator.
- Install root explorer
- Create a new folder at root (/), for example "boottmp" => "/boottmp"
- Launch terminal emulator
- type: "su"
- type: "mount /dev/block/mmcblk0p1 /boottmp"
- type: "echo -n -e "\x08\x00\x00\x00" > /rom/devconf/BootCnt" (this will force reset on next boot, as if you did 8 failed boots)
- open browser
- Download boot.zip from here: http://forum.xda-developers.com/showpost.php?p=10470539&postcount=268
- copy zip content to "/boottmp", by replacing existing files
- shutdown
- remove sdcard
- power up, you should see installation process after splash screen. Wait for it to finish, and it will reboot.
- power off
- Next you need to reset to factory settings:
- Boot while using power button and N button. Should boot to menu allowing reset. Proceed with reset.
Boot and be happy.
Click to expand...
Click to collapse
Works perfectly, thanks! I actually used adb instead of root explorer to do the copy and mount (etc.) commands, and did a manual 8-times power start interruption, but essentially the same. This made my poor "sound-failing" Nook a virgin again so I can swap it out at the store today. Crossing fingers that they will provide quick and easy exchange service (and let me test the sound on the replacement before I leave the store!)... Then, back to Autonooking (and even back to Clockwork Recovery...) again; now that I know how to go back and forth.
Owe you (or y'all) a beer!

[Q] Accessing /data if CM9 won't boot

How can I access the /data/ partition?
I was using the touchpad, installed some apps like teamviewer/unified remote/xbmc from the market, and all was going well and then for no reason the tablet froze, CM9 just stopped responding. So I rebooted it (holding the home button and power button was the only way to get it to do anything) but it's stuck at the Cyanogenmod boot animation. It's been on that animation for 5-10 minutes, so I rebooted again, went into clockworkmod and reflashed the latest nightly and gapps. I then rebooted, android booted up, said it was upgrading/optimizing 77 something apps, then it said it was starting the apps, and then it froze at that point, wouldn't proceed. I then reboot and am stuck at the boot animation again. My best guess is that one of the apps I installed is hosing it. I plugged the usb cable in and normally during the boot animation of my phone I can adb logcat but I can't seem to adb detect this device during boot animation. Windows see's it as a MTP device but no filesystem comes up in my computer. So adb logcat and adb shell so I can get into /data/app to wipe out the last few apps I installed won't work, but on my phone I can also adb shell in from CWM. So I rebooted into CWM but when I connect the cable to the laptop it still doesn't see it as an Android ADB device. No adb shell. Not like my phone at all.
So back to my original question, short of wiping /data from CWM, is there anyway for me to get at /data/app to delete some files? I'm curious what's causing this.
You can do an and pull from clockwork mod or have you tried mounting it on the computer from the clockwork mod options?
I've mounted before in clockwork but only sdcard, so that i can put a zip on it to flash. Can you also usb mount the /data partition?
Sent from my SGH-I777 using XDA
If you can reboot into WebOS, I know a way you can mount it and grab what you need.
Boot into WebOS, and connect your tablet to your PC. Then start up Novaterm (C:\Program Files\Palm, Inc\terminal\novaterm.bat). Connect to your tablet.
From there, you'll be at a root prompt. This is good. Type the following commands:
- mount /dev/mapper/store-media /media/card
- mount /dev/mapper/store-cm--data /media/hdd
- cd /media/hdd
- mkdir /media/card/cmdata (this will make a backup folder for you)
From there, you can use basic linux commands to copy files from your data partition to your media card. The ones you should need (forgive me listing the extra commands, even if you know them):
- ls (LS) will give you a directory listing
- cp -r <Folder> /media/card/cmdata (this will backup whatever folder you wanna backup to the cmdata on your card)
- rm -r <folder> (this will remove whatever folder you wanna remove)
- rm <filename> (this will remove whatever file you wanna remove)
I just tested this method, and it allows you to back up whatever you want, as long as you can get into your /data partition. You can do whatever you need to do. Just be careful you don't remove something you don't have to.
Hope this helps you, mate. If so, hit Thanks, if not, drop me a PM and we'll discuss other options.
glitchsys said:
I've mounted before in clockwork but only sdcard, so that i can put a zip on it to flash. Can you also usb mount the /data partition?
Click to expand...
Click to collapse
Yes, you can, but you can only read it from a Linux PC. A Windows system will not be able to access the partition, because it is an ext3 filesystem.
You can also use the "USB mode" used to install CM, but it will run into the same problem. Without Linux, you will not be able to access files.
I would clear the cache, that usually seems to solve these kind of issues. (Of course it could also mess it up further...)

[Q] Fastboot will not see my device, Recovery does. Unable to push files.

I had the SD card issue where it wasn't seeing all my files. Recovery mode would see files I could not locate within the os.
What I did:
Backed up my contents. Always have a nandroid backup!
Downloaded and md5sum checked Trickdroid 8.0.0
Booted into recovery, wiped phone. Formatted all partitions.
My next plan of action was to adb push trickdroid. This failed, its not seeing my sdcard partion. I have attempted to format /sdcard. It returns no errors. I got to mount /sdcard, It fails to find the directory.
When I boot into fastboot (Thinking at the very worst I could relock my device nad flash an RUU)
It does not see any devices. I have verified multiple times that I am using the correct driver. I have removed all drivers from the system, attempted to use htc sync, uninstalled that, used the Naked Drivers, uninstalled those (still no device in fastboot), installed the ADB Driver installer (found using the search button). Still, no devices in fastboot.
If someone could point me in the right direction I would greatly appreciate it. I have been using adb and flashing devices for a number of years and have not yet encountered a problem like this.
-Erik
voltage88 said:
I had the SD card issue where it wasn't seeing all my files. Recovery mode would see files I could not locate within the os.
What I did:
Backed up my contents. Always have a nandroid backup!
Downloaded and md5sum checked Trickdroid 8.0.0
Booted into recovery, wiped phone. Formatted all partitions.
My next plan of action was to adb push trickdroid. This failed, its not seeing my sdcard partion. I have attempted to format /sdcard. It returns no errors. I got to mount /sdcard, It fails to find the directory.
When I boot into fastboot (Thinking at the very worst I could relock my device nad flash an RUU)
It does not see any devices. I have verified multiple times that I am using the correct driver. I have removed all drivers from the system, attempted to use htc sync, uninstalled that, used the Naked Drivers, uninstalled those (still no device in fastboot), installed the ADB Driver installer (found using the search button). Still, no devices in fastboot.
If someone could point me in the right direction I would greatly appreciate it. I have been using adb and flashing devices for a number of years and have not yet encountered a problem like this.
-Erik
Click to expand...
Click to collapse
I fixed it!!! Anyone that has a similiar issue. This is what I did.
In a previous thread, I saw that 4.2 will redo the sd card structure. After some research, it was recommended to change the path to /data/media/0. I was then attempting to do the command as follows 'adb push Trickdroid_8.0.0.zip /data/media/0' (without tick marks)
The file was pushing as it should (no progress bar) however, it would fail at the very end saying it was unable to locate the directory.
After seeing adb fail in that manner, I knew my sdcard was not mapped to the above path. What I did was boot into recovery, go to mounts and storage, mount my sdcard. Go back to the first menu now.....From here, select advance, and view log. It will tell you where your sdcard is being mapped to. Simply push your zip file to this directory and success! I have a working phone again.
Fastboot still doesn't recognize my device however. I'd be more then happy to be educated as to what I may have done wrong.

[HOWTO] [GUIDE] Repairing corrupted /data partition

I had an experience the other night that I found rather frightening and enlightening, and felt the need to contribute my learning. I attempted to install a new ROM on my Nexus 5 and encountered a freeze during the /system write process. I waited 30 minutes and decided it wasn’t going to finish, so I powered off. As an avid and experienced ROM flasher I knew this could hurt, and knew it was an inevitable requirement.
Upon rebooting back to recovery (I had already wiped /system /data, etc. in preparation for a new ROM) I found that I was unable to mount /data and subsequently /sdcard. I received a few different errors depending on which recovery I attempted (fastboot flashed). I was given neat things like “Enter password to decrypt /data” – TWRP, or “E: Unable to mount /data, invalid argument”, “E: Error mounting /data”, “E: Error mounting /sdcard”.
During all of this I realized I could get an ADB shell going from within Philz recovery (I am not sure if TWRP or CWM do this, nor did I try). After much research, and very much to my dismay, I was unable to find a complete guide or walkthrough for how to go about recovering from this. This is the procedure I glued together from my own digging and manual learning of the commands required. This procedure may or may not work in all cases but is a viable step to recovering your /data partition before going the nuke & pave route with the factory image!
(NOTE: I’ll try to keep this as simple as possible. I am not a dev. I do this for fun/learning in the little free time I get and am not typically available to assist, so please use this only if you feel comfortable with the material. Flashing a ROM/Kernel/etc. is one thing. Digging in the innards of the Android partitions/file system is a whole other beast! To be VERY clear: I am not responsible for damages or loss incurred by the use or misuse of this information.) Also note, if you have an ADB enabled recovery, you can probably try this process against your devices partitions as well.
The following instructions assume you are unable to mount /data or /sdcard on the Nexus 5 and are receiving errors. This also assumes that the wipe /cache function is not resolving the issue for you (as this seems to work for some depending on the issue).
Prerequisites:
- Philz recovery for LGE Nexus 5 (http://forum.xda-developers.com/showthread.php?t=2565174)
- Android ADB interface drivers and software (Available from existing root toolkits and SDK)
- Fastboot executable (Also available from existing root toolkits and SDK)
***Note: I performed all of this from Windows 8. The toolkit I used was Wug’s Nexus Root Toolkit (http://forum.xda-developers.com/showthread.php?t=2517778). If you are a Windows user, read and follow the toolkit instructions to install the drivers. Use the Advanced Utilities[Launch]->Manual Input[Launch CMD Prompt] to bring up a Command prompt and perform the steps below.
- For simplicity, ensure that the ADB and Fastboot binaries are in the same location if you are gathering these binaries from the SDK or other source.
- Create a folder that you can later use to pull recovered files from your phone. (if so desired)​
Terminologies used:
- Terminal = Command Prompt (Windows), Bash/etc (Linux), Terminal (MacOSX)
- Fastboot = Application that interfaces with the Bootloader (flash/wipe partitions, etc)
- ADB = Android Debug Bridge (Provides an interface to interact with Android filesystem)
- Binaries = Files containing executable code (for this context, ADB and Fastboot applications)
- Bootloader = Think of it as the EFI or BIOS equivalent for your phone. (Accessed with VOLDN+PWR)
- Recovery = CWM/TWRP/Philz (We will be using Philz, as this was what I used to write this guide)​
Steps:
1. Install all required drivers and prerequisites listed above.
a. Use Wug’s toolkit or whatever method gets your drivers installed for your OS.​b. If you are not familiar with this process, then please research!​
2. Power off your phone and connect via USB to your PC.
3. Power your phone into the bootloader by holding the PWR+VOLDN keys
4. In a Terminal, browse to the location of your fastboot binaries. (See prerequisite note for Wug’s)
a. Enter ‘fastboot devices’ to verify that your phone is detected. If it returns a “<serialnumberofdevice> fastboot” then you may proceed. If it does not, please check your driver installation and start over.​
5. Flash and boot to Philz recovery:
a. Extract the ‘recovery.img’ file from Philz Recovery ZIP and place in the same location that fastboot and adb binaries are located.​b. Enter ‘fastboot flash recovery recovery.img’ (without quotes) in the Terminal. This will write the new recovery.​c. Once complete (takes a brief second usually), use the VOLUP/DN keys until the Bootloader shows “Recovery Mode” and press the power key. Your phone should now be booting into Philz recovery.​
6. Use ADB to launch a root shell from within Philz recovery
a. Ensure that the drivers are now detecting your device as an ADB ready device by entering: ‘adb devices’. If it returns “<serialnumberofdevice> recovery” then you are ready to proceed. If it does not, please verify your ADB driver installation and check again.​b. Enter: ‘adb shell’ to gain full root shell access to the Android file system. (You should see a “~#” prompt to show that you’re now in a root shell)​
7. Attempt repair of /data partition. This partition includes /sdcard and dalvik. (/sdcard is linked to /data/media) At the ~# prompt:
a. Enter: ‘e2fsck /dev/block/platform/msm_sdcc.1/by-name/userdata’​b. You should now be prompted to repair or fix errors. Press [Enter] key to use the default answer of for yes. If you are not, then this fix may not apply to you.​c. Continue pressing [Enter] until the process completes.​d. Proceed to next step if you have gotten this far.​
8. Attempt to manually mount the data partition.
a. We are going to mount /data as read-only for now. To do this, enter: ‘mount /dev/block/platform/msm_sdcc.1/by-name/userdata /data’​b. If mount is successful, it will simply drop down to the next blank shell prompt. If it fails, you will receive an error. If you receive an error, then the repair has failed.​c. If you did not receive an error, you can now browse to your /data and /sdcard partitions. This is accomplished by entering: ‘cd /data’ for /data, and ‘cd /data/media/0’ OR ‘cd /sdcard’ for your /sdcard (/sdcard is a link that will drop you directly to /data/media/0)​
9. BACKUP YOUR ENTIRE SDCARD TO YOUR COMPUTER!!! (Optional, but highly recommended)
a. Enter: ‘adb pull /data/media <path_on_computer>’​b. <path_on_computer> will be a folder you created in the prerequisites.​c. Wait for this process to complete.​
Congratulations! You may now proceed to launch recovery and flash at will. I highly recommend after making the backup in step 9 that you perform a full factory reset to correct any potential lingering issues with the partitions. You can then push the files back to your /sdcard by mounting /data as RW using ADB shell through Philz recovery (please reference the ‘mount’ and ‘adb’ command utilities for information about how to do this).
If you find yourself in the unfortunate position to have to use this, please share your results in the forum for others. If you find something does not work, please post it (I will check occasionally and update as I can). I do not frequent my PM’s, and again, I am not available to provide support. Please understand this and use at your own risk.
If this helped you, then my job here is done . Thanks for reading!
(I am not affiliated with any of the devs that provide these tools. Be sure to thank them if you used their tools, as they deserve all credit for enabling and teaching us to do these things – even when we do break our own stuff!)
Nice guide I'm sure this is going to be very useful for a lot of people. :thumbup::thumbup:
Sent from my Nexus 5 using Xparent BlueTapatalk 2
Really helpful guide, I corrupted the data and cache partition while updating (via official OTA by sideload) to 4.4.1 (full stock Nexus 5), and I had to format all flashing then factory image and losing all the data...
Now if it does happens another time, I'll know what to do.
Thanks
Good write up but, I don't recommend tool kits. You can do all this with fastboot commands. You could just flash userdata image with fastboot
As a Linux admin, I'd wanna format /data after pulling off any files I wanted to keep rather than just rely on fsck . Is that an option? Is mkfs even on the recovery?
Sent from my BN NookHD+ using xda app-developers app
Thanks for sharing.
My nexus5 cant mount cache partition and i cant flash to stock factory,this maybe helpful.
Thank you again.
ywt474000158 said:
Thanks for sharing.
My nexus5 cant mount cache partition and i cant flash to stock factory,this maybe helpful.
Thank you again.
Click to expand...
Click to collapse
Can you fastboot flash the cache.img?
razholio said:
As a Linux admin, I'd wanna format /data after pulling off any files I wanted to keep rather than just rely on fsck . Is that an option? Is mkfs even on the recovery?
Sent from my BN NookHD+ using xda app-developers app
Click to expand...
Click to collapse
I'm no Linux admin but there's a wipe /data button which does that in TWRP and also probably in CWM.
Sent from my Galaxy Nexus using Tapatalk
Somehow it seems as though all of my partitions have been wiped/corrupted and I was directed to this thread as possible help. When trying to run step 7 command(had to do it with CWM v6.0.4.5 as it doesn't seem to want to keep philz when sideloading or fastboot flashing it), it gives me the following response:
e2fsck: 1.41.14 (22-Dec-2010)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/block/platform/msm_sdcc.1/by-name/userdata
The super block could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>
My phone was having freezes and shutdowns so I decided to flash a new ROM to freshen things up and it failed and aborted. After that I've got no android to boot into and I can't mount or access any of the partitions. I've got fastboot and adb, but no clue where to begin as it seems like I have to recreate my partition table but can't find any info on doing that for the nexus 5 itself
tidoubleger said:
Somehow it seems as though all of my partitions have been wiped/corrupted and I was directed to this thread as possible help. When trying to run step 7 command(had to do it with CWM v6.0.4.5 as it doesn't seem to want to keep philz when sideloading or fastboot flashing it), it gives me the following response:
e2fsck: 1.41.14 (22-Dec-2010)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/block/platform/msm_sdcc.1/by-name/userdata
The super block could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>
My phone was having freezes and shutdowns so I decided to flash a new ROM to freshen things up and it failed and aborted. After that I've got no android to boot into and I can't mount or access any of the partitions. I've got fastboot and adb, but no clue where to begin as it seems like I have to recreate my partition table but can't find any info on doing that for the nexus 5 itself
Click to expand...
Click to collapse
Have you tried this yet http://forum.xda-developers.com/showthread.php?p=47156064
jd1639 said:
Have you tried this yet http://forum.xda-developers.com/showthread.php?p=47156064
Click to expand...
Click to collapse
Yes I tried it by using the flash-all.bat, flashing individually, and even Wug's toolkit as a last resort there but got nothing. When flashing the bootloader and radio it sends over fine but then gives me FAILED (remote: flash write failure) and finishes. When trying to flash the system or userdata it gives me FAILED (remote: failed to erase partition) and ends.
tidoubleger said:
Yes I tried it by using the flash-all.bat, flashing individually, and even Wug's toolkit as a last resort there but got nothing. When flashing the bootloader and radio it sends over fine but then gives me FAILED (remote: flash write failure) and finishes. When trying to flash the system or userdata it gives me FAILED (remote: failed to erase partition) and ends.
Click to expand...
Click to collapse
I'm thinking your emmc went bad. Rma is probably your option right now
jd1639 said:
I'm thinking your emmc went bad. Rma is probably your option right now
Click to expand...
Click to collapse
Well as far as Google knowing it, if I am able to successfully reset the tamper flag and lock the bootloader am I good to go or will they still find out?
tidoubleger said:
Well as far as Google knowing it, if I am able to successfully reset the tamper flag and lock the bootloader am I good to go or will they still find out?
Click to expand...
Click to collapse
If all your positions are corrupted I doubt you'll be able to reset the tamper flag. But also, no one will be able to see the tamper flag. But try to reset it and try to relock the bootloader. I don't think anyone will be able to tell if you modified anything or not.
not know
Did not know this could be done
jd1639 said:
If all your positions are corrupted I doubt you'll be able to reset the tamper flag. But also, no one will be able to see the tamper flag. But try to reset it and try to relock the bootloader. I don't think anyone will be able to tell if you modified anything or not.
Click to expand...
Click to collapse
Hmm, I can see that the tamper flag is still true even after running that zip because it still fails because it can't mount /cache. I'm getting the feeling that the partitions aren't corrupted but have just been wiped or something. When I booted into TWRP through fastboot I was able to adb push to the sdcard and it showed up in the list when trying to install a zip, however the Internal Storage still read 0MB. I won't be able to RMA it for a few more days so if any other ideas come about, I'm all for it as I'd rather not have to RMA this lol
tidoubleger said:
Hmm, I can see that the tamper flag is still true even after running that zip because it still fails because it can't mount /cache. I'm getting the feeling that the partitions aren't corrupted but have just been wiped or something. When I booted into TWRP through fastboot I was able to adb push to the sdcard and it showed up in the list when trying to install a zip, however the Internal Storage still read 0MB. I won't be able to RMA it for a few more days so if any other ideas come about, I'm all for it as I'd rather not have to RMA this lol
Click to expand...
Click to collapse
In twrp 2.6.3.4 have you tried going into wipe and then format data?
@tidoubleger I am going to call in some RCs that were having this problem on an N7. They eventually got it sorted and up and running. They might be able to help.
@demkantor @MameTozhio @kilometers4
Fellas, would you be able to help this person out the same way you did here.
jd1639 said:
In twrp 2.6.3.4 have you tried going into wipe and then format data?
Click to expand...
Click to collapse
Yeah it fails due to being unable to mount /cache.
Woody said:
@tidoubleger I am going to call in some RCs that were having this problem on an N7. They eventually got it sorted and up and running. They might be able to help.
@demkantor @MameTozhio @kilometers4
Fellas, would you be able to help this person out the same way you did here.
Click to expand...
Click to collapse
Thanks Woody, I appreciate the call to arms I'm currently at Disneyworld, so I won't be able to test anything until this evening but will do my best to answer questions until then
tidoubleger said:
Somehow it seems as though all of my partitions have been wiped/corrupted and I was directed to this thread as possible help. When trying to run step 7 command(had to do it with CWM v6.0.4.5 as it doesn't seem to want to keep philz when sideloading or fastboot flashing it), it gives me the following response:
e2fsck: 1.41.14 (22-Dec-2010)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/block/platform/msm_sdcc.1/by-name/userdata
The super block could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>
My phone was having freezes and shutdowns so I decided to flash a new ROM to freshen things up and it failed and aborted. After that I've got no android to boot into and I can't mount or access any of the partitions. I've got fastboot and adb, but no clue where to begin as it seems like I have to recreate my partition table but can't find any info on doing that for the nexus 5 itself
Click to expand...
Click to collapse
I had the same problem. This is how I got it sorted.
follow these steps and you should get it sorted
fastboot erase system -w
fastboot erase boot
fastboot erase recovery
fastboot flash bootloader bootloader.img
fastboot flash recovery recovery.img
once it flashes, boot into recovery.
format sdcard (i believe it is)
Now adb sideload ROM and gapps
I have class until this afternoon, but that should get it fixed
If you have any hangups post it here and I'll help you when I'm free.
Good Luck

Categories

Resources