[HOWTO] [GUIDE] Repairing corrupted /data partition

Search This thread

sandy7874

Senior Member
Apr 9, 2011
420
85
Mumbai
OnePlus 9 Pro
Try This Method

Guys, just give a try to below method -

Select System - Click Change or Repair partition, click Repair.

Select Data - Click Change or Repair partition, click Repair. (If this fails, try changing from Ext to FAT and back to EXt) (Will Wipe all of ur N5 SD Card)

Select any Rom Zip (just rom zip, flash gapps after 1st successful boot). Your N5 partitions are ready and N5 will boot. :)
 

OzziJosy

Member
Jul 26, 2014
19
2
Hello

I know it's a Nexus thread but seems I got a similar /data unmountable error on my XT925.
Is there a way to restore my /data partition without losing my data?
Thank you for any help or links to follow.
 

sayedamir02

Member
Jan 21, 2011
7
1
When I type ‘e2fsck /dev/block/platform/msm_sdcc.1/by-name/userdata’
I get this:
~ # e2fsck /dev/block/platform/msm_sdcc.1/by-name/userdata
e2fsck 1.41.14 (22-Dec-2010)
/dev/block/platform/msm_sdcc.1/by-name/userdata has unsupported feature(s): comp
ression FEATURE_I5 64bit FEATURE_I8 FEATURE_I10 FEATURE_I11 FEATURE_I12 FEATURE_
I13 FEATURE_I14 FEATURE_I15 FEATURE_I16 FEATURE_I17 FEATURE_I18 FEATURE_I19 FEAT
URE_I20 FEATURE_I21 FEATURE_I22 FEATURE_I23 FEATURE_I24 FEATURE_I25 FEATURE_I26
FEATURE_I27 FEATURE_I28 FEATURE_I29 FEATURE_I30 FEATURE_I31 FEATURE_R2 FEATURE_R
7 FEATURE_R8 FEATURE_R9 FEATURE_R10 FEATURE_R11 FEATURE_R12 FEATURE_R13 FEATURE_
R14 FEATURE_R15 FEATURE_R16 FEATURE_R17 FEATURE_R18 FEATURE_R19 FEATURE_R20 FEAT
URE_R21 FEATURE_R22 FEATURE_R23 FEATURE_R24 FEATURE_R25 FEATURE_R26 FEATURE_R27
FEATURE_R28 FEATURE_R29 FEATURE_R30 FEATURE_R31
e2fsck: Get a newer version of e2fsck!
~ #
What should I do? Any help would be appreciated
 

Waqas Khattak

Member
Nov 21, 2015
21
0
I tried...

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

I tried all of these commands but every time I end up with the same error "Failed <Remote: failed to erase Partition" and "failed remote flash write failure"
 

Travisdroidx2

Senior Member
Sep 9, 2011
3,699
976
Bay Area California
So I had this problem. In twrp I could not mount to the SD card or even make a Nano back up without getting the mount error. Here is what I did to fix mine. Flashed the stock factory images to full stock. Then rooted the traditional method by flashing the modified boot before twrp from this thread.http://xdaforums.com/nexus-5x/general/guides-how-to-guides-beginners-t3206930 After flashing the modified boot.img and reflashing twrp everything works fine. I was able to make my back up and flash a rom with no issues. No more corrupt message also. Hope it helps someone else. I flashed supersu after twrp was up and running. All is well now.
 
Last edited:

Tomeygun

Senior Member
Aug 31, 2008
57
5
Long time lurker. Thank you for helping by putting all the tools in one place. My N5 was bricked far enough that only thing it would do was boot to stock recovery but would error out on every option. Got it back to life and now the N.I.B LG G4 sits on my dresser...
 

k001daddy

New member
Mar 18, 2016
2
0
Kissimmee, FL
Running e2fsck worked for me! I already had TWRP installed but it could not mount /data. I ran e2fsck within TWRP's terminal, after cat /etc/fstab to see which device was /data, and don't forget the -y option so it doesn't ask for yes/no every two and a half seconds! I was then able to mount /data and proceed with wipe then restore. My system came back up as if nothing had happened! Thanks!
 

dpv09

Member
Mar 13, 2016
5
0
I had the same problem in my moto g 2014 , and found one solution!! I'm so excited!
its sounds crazy but you have to bootloop your phone, first in the custom recovery, section mount check system, cache , (data is unable to check), after that go to install/ and install any rom that you have, any gapss or any file that make you a bootloop, don't make a wipe!! , after that reboot your phone and make sure that you have a bootloop, if you don't have it, try again!! hah . After that turn on your phone on fastboot and make a downgrade. :)
in my case (MOTO G 2014) i used 5.0.2 XT1063_TITAN_RETLA_5.0.2_LXB22.99-16.3_Easy_Installer
That's all and sorry for my bad english :)
 
Apr 19, 2016
16
6
PDX
When the same problem with /data occurred on my Note4, I used the terminal applet within later versions (3.0.2-0 in my case) of TWRP. e2fsck didn't solve my problem but mke2fs did. For some reason, the TWRP GUI wipe/repair/format tool wouldn't do anything but throw off errors but mke2fs worked like a charm. After creating a new ext2 file system from the shell, the TWRP GUI tool upgraded it to ext4 without a hitch. I then flashed CM12.1 from within TWRP and all was working well.

My guess is that using the NAND erase option in Odin while flashing a new stock ROM borked the partition. Once I got everything working again under CM12, I flashed the latest ROM for my device again, this time without the NAND erase. Honestly, I knew better than to mess with options within Odin but I got complacent and figured it would save a few steps in cleaning up everything for upgrading cleanly from LP to MM. I was lucky to get off so light after dicking around within Odin like that.
 

Nischay M M

Member
Jan 23, 2016
23
6
Hello when ever I try flash ROM SuperSU and kernels. I get a"unable to mount storage" error in TWRP. But there would be no problem in flashing and everything boots up and works fine.

Why would that error message occur and any fix to it??
 

sharathe100111

Senior Member
Sep 26, 2016
58
26
ASUS ROG Phone II
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 :)

please @matteventu i need your help.
My device is Xiaomi Redmi 1s.
i found your post here about corrupted data and cache partitions. In my device also same issue here. i can't do anything. the above commands by op in adb shell doesn't work for me.
Here my error is:
"E:primary block device '/dev/block/bootdevice/by-name/userdata' for mount point '/data' is not present
Failed to mount '/cache' (Invalid argument)
Failed to mount '/data' (Invalid argument)
Unable to recreate /data/media folder
"
i am unable to get screenshots or recovery logs because unable to mount storage.

So someone please help me in solving this problem.
 

dhruv21singla

Member
Aug 18, 2016
8
0
helppp

i am having an android phone yuphoria an indian phone same probem is there nd i am unable to find solution pease hep me stucked
 

Top Liked Posts

  • There are no posts matching your filters.
  • 73
    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://xdaforums.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://xdaforums.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 (y) 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!)
    3
    I would try formatting the partitions separately and then flashing new firmware/software
    fastboot erase system
    fastboot erase cache
    fastboot erase userdata
    fastboot erase recovery
    fastboot erase boot
    Then I would extract these images from here
    https://developers.google.com/android/nexus/images#hammerhead
    And start with bootloader
    fastboot flash bootloader nameofbootloader.extension
    .img .nb0 whatever
    Then
    fastboot flash radio nameofradio.img
    (maybe modem can't recall on these so look for modem if need be)
    fastboot flash recovery nameofrecovery.img
    fastboot flash system
    fastboot flash userdata
    fastboot flash cache
    And so on
    If any errors please post all input/output from cmd in codewraps here or pastebin link
    3
    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

    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
    2
    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
    2
    Ok can you try it from here:
    fastboot flash recovery recovery.img (use this recovery if you have a grouper tab http://techerrata.com/browse/twrp2/grouper)
    once it flashes, boot into recovery.
    format sdcard (i believe it is) (keep in mind this will obviously wipe all of the data from the device)
    Now adb sideload ROM and gapps

    Hey Kilometers, he is having trouble with the N5 "Hammerhead", so make sure that you curtail your responses towards that. I know your issue was with the N7, but since the issues were extremely similar is why I ask.