for a stupid reason I used TWRP which is btw a stupid tool... long story short.. It messed up the data partition...

Currently I have a nexus 5 that can run whatever recovery I want, but doesn't have a /data partition...

How do I fix my phone so that I can install any ROM for complete reference here are some of the info

when ever I try factory reset (using CWM) I get the following error

--Wiping data...
Formatting /data...
E:Error mounting /data!
Formatting /cache...
Formatting /sd-ext...
E:unknown volume for path [/sd-ext]
Formatting /sdcaard/.android_secure...
E:Error mounting /sdcaard/.android_secure!
Data wipe complete

I've tried adb shell and then running the following

~# e2fsck /dev/block/platform/msm_sdcc.1/by-name/userdata

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 superblock 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>

2 Answers 2


Try doing what it suggests... run e2fsck -b 8193 /dev/block/platform/msm_sdcc.1/by-name/userdata. If that doesn't work, try running mke2fs /dev/block/platform/msm_sdcc.1/by-name/userdata.

You can also boot into fastboot mode and run fastboot erase userdata.

If none of these work, please elaborate on this "long story". How did you mess up your data partition with TWRP? Got any logs/error messages/steps to reproduce? I've been using TWRP ever since I started using custom ROMs and never had an issue.

  • all of these didn't work.... e2fsck -b 8193 etc. returned the same error, mke2fs /dev/block/platform/msm_sdcc.1/by-name/userdata creates the data partition but when i install any rom it hangs on the booting animation, fastboot format userdata there is no format option only erase and it has no effect.... please help.
    – a14m
    Commented Nov 20, 2014 at 10:07
  • So what exactly did you do? Try flashing a factory image. Instructions are at the top of that page. Be warned this will wipe anything that's left on your phone, including CWM/TWRP/whatever.
    – keepcalm
    Commented Nov 20, 2014 at 10:38
  • yeah i'm trying to flash a factory image and the problem is that after it's flashed i re install fastboot recovery and i find that there is no data partition... again after the factory flush-all.sh
    – a14m
    Commented Nov 20, 2014 at 10:58
  • Ok, so can you explain what you did to cause the corruption of your data partition?
    – keepcalm
    Commented Nov 20, 2014 at 11:11
  • it was the format /system /cache by TWRP(i make format those things before flashing a new ROM) then when i flashed the rom it hung and i restart the mobile and since then i have the problem... one other thing... is there any place where i can find stock android images made by CWM (clockworkmode) maybe it could work...
    – a14m
    Commented Nov 20, 2014 at 11:52

This solution fixed the issue of device stuck at boot logo.

  • Boot into TWRP or any other similar recovery.
  • Enter adb shell in a terminal on your PC while running recovery on the phone.
  • Enter e2fsck /dev/block/platform/msm_sdcc.1/by-name/persist. Should work for other partitions that might be corrupt as well (Query Google to find more Android partitions).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .