[HOW TO] Fix "Failure to mount" sdcard, system, data or cache

Search This thread

Will11690

New member
Nov 7, 2014
3
2
Help!

Hi, I used this to unbrick my kindle fire after forgetting to unmount the partitions and using fire parted which removed /data, /cache, /system, and /sdcard completely but now I have another problem. When I try to resize the sdcard partition using parted it says the partition is still in use even though I unmount it. Any clue what is going on and how to fix it?
 

henryli333

Member
Sep 21, 2016
32
1
**IMPORTANT**
Read this thoroughly before you attempt any of it. The steps found herein will wipe out any data remaining on the partition for which it's used. If a partition has lost it's formatting, chances are the data is lost anyway, so there's not much more you can lose. This should be thought of as a last resort. Do not attempt this until you have tried everything else.


In many cases, just wiping the affected partition in recovery is enough to fix the problem. If not, continue reading.

If it's your sdcard that needs to be mounted, there is one thing you can try that might work in most cases.

Code:
[COLOR=Gray]$[/COLOR] adb shell
[COLOR=Gray]~ #[/COLOR] echo /dev/block/mmcblk0p12 >> /sys/devices/platform/usb_mass_storage/lun0/file
Your computer will probably respond that the volume/device needs formatted before using it. This will erase everything left on the sdcard, as will anything else you attempt in this thread.

* Choose a quick format (if possible) and format it as "fat32", block size "4096".



If that doesn't work...


You'll have to reset your partition table, just in case (this step is optional but it doesn't hurt to do it anyway).

You'll need to be in fastboot:

Code:
[COLOR=Gray]$[/COLOR] adb shell
[COLOR=Gray]~ #[/COLOR] idme bootmode 4002
[COLOR=Gray]~ #[/COLOR] reboot
(*COTR recovery doesn't have idme so you'll have to use the recovery itself to reboot into the bootloader)


Once in fastboot, enter the following commands...

Code:
[COLOR=Gray]$[/COLOR] fastboot oem format
[COLOR=Gray]$[/COLOR] fastboot oem idme bootmode 5001
[COLOR=Gray]$[/COLOR] fastboot reboot
With your partition table reset, it's time to print your partition table for reference.



For this, your device must be booted into recovery.


To print your partition table:

Code:
[COLOR=Gray]$[/COLOR] adb shell
[COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
[COLOR=Gray](parted)[/COLOR] print
This will print the layout of your partitions 1-12. It should look something like this:
View attachment 1421197


If you receive an error stating that parted can't be found, you need to find and download it and enter the following commands, or update your recovery...

Code:
[COLOR=Gray]$[/COLOR] adb push /path/to/parted /sbin/parted   
[COLOR=Gray]$[/COLOR] adb shell
[COLOR=Gray]~ #[/COLOR] chown 0.0 /sbin/parted
[COLOR=Gray]~ #[/COLOR] chown 755 /sbin/parted
(*replace "/path/to/parted" with the full path to the parted binary downloaded to your computer)


Once you have your partition table printed out, copy and save it to a text file for later use.


When looking at the partition table, pay close attention to the file systems of the system, userdata, cache and media partitions. System, data and cache, should have an "ext4" formatting, while media should have a "fat32" formatting. The partitions that are missing the proper formatting are the ones you need to focus on because they need to be removed and repartitioned.


----------------------------------------------------------------------------------------------------------------------------------------
NEVER MESS WITH ANYTHING OTHER THAN SYSTEM, DATA, CACHE AND MEDIA!!!
----------------------------------------------------------------------------------------------------------------------------------------


The following, are the steps to repartition the system, data, and cache partitions. Media (sdcard) will have it's own steps so don't get them mixed up. These same steps will be used for each of the system data and cache partitions except you'll substitute the variables (in green) with the values for that particular partition. Be careful NOT to get the any of numbers mixed up or confused or you could potentially do serious damage to your device.

Code:
[COLOR=Gray]$[/COLOR] abd shell
[COLOR=Gray]~ #[/COLOR] umount [COLOR=SeaGreen]"directory_name"[/COLOR]  [COLOR=Red]<---- This command is to make sure the volume isn't already mounted.  If you get an error, it just means there is no volume mounted.  Disregard.[/COLOR]
[COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
[COLOR=Gray](parted)[/COLOR] rm [COLOR=SeaGreen]"partition_number"[/COLOR]
[COLOR=Gray](parted)[/COLOR] mkpart primary [COLOR=SeaGreen]"startblock" "endblock"[/COLOR]
[COLOR=Gray](parted)[/COLOR] name [COLOR=SeaGreen]"partition_number" "partition_name"[/COLOR]
[COLOR=Gray](parted)[/COLOR] quit
[COLOR=Gray]~ #[/COLOR] mke2fs -t ext4 /dev/block/mmcblk0p[COLOR=SeaGreen]"partition_number"[/COLOR]
[COLOR=Gray]~ #[/COLOR] mount [COLOR=SeaGreen]"directory_name"[/COLOR]
The values for the previous command variables are as follows...

SYSTEM
-------------------------------
"partition_number"= 9
"directory_name" = /system
"partition_name" = system
"startblock" = 312
"endblock" = 849

DATA
-------------------------------
"partition_number"= 10
"directory_name" = /data
"partition_name" = userdata
"startblock" = 849
"endblock" = 2041

CACHE
-------------------------------
"partition_number"= 11
"directory_name" = /cache
"partition_name" = cache
"startblock" = 2041
"endblock" = 2309

For example, in order to fix the DATA partition, the commands would be written like this...

Code:
[COLOR=Gray]$[/COLOR] abd shell
[COLOR=Gray]~ #[/COLOR] umount /data
[COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
[COLOR=Gray](parted)[/COLOR] rm 10
[COLOR=Gray](parted)[/COLOR] mkpart primary 849 2041
[COLOR=Gray](parted)[/COLOR] name 10 userdata
[COLOR=Gray](parted)[/COLOR] quit
[COLOR=Gray]~ #[/COLOR] mke2fs -t ext4 /dev/block/mmcblk0p10
[COLOR=Gray]~ #[/COLOR] mount /data
The following are the steps to repartition the media (sdcard) partition.

Code:
[COLOR=Gray]$[/COLOR] adb shell
[COLOR=Gray]~ #[/COLOR] umount /sdcard    [COLOR=Red]<----Same as before.  If you receive an error on this command, just disregard it.[/COLOR]
[COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
[COLOR=Gray](parted)[/COLOR] rm 12
[COLOR=Gray](parted)[/COLOR] mkpartfs primary fat32 2309 7690
[COLOR=Gray](parted)[/COLOR] rm 12
[COLOR=Gray](parted)[/COLOR] mkpart primary 2309 7690
[COLOR=Gray](parted)[/COLOR] name 12 media
[COLOR=Gray](parted)[/COLOR] quit
[COLOR=Gray]~ #[/COLOR] mount /sdcard
Once again, any partitions on which these commands are used, will lose any data left on them, but chances are it's your only option. Pay very close attention to what you are doing and be very cautious of typos. Accidentally entering /dev/block/mmcblk0p2' instead of "/dev/block/mmcblk0p12" will brick your device, to the point of needing to pull the back cover off and shorting it...well...let's just say you don't want to have to do that.


Afterwards you should be able to mount the effected partitions in recovery.


Be careful, and good luck.


Refrences:
http://xdaforums.com/showpost.php?p=26285877&postcount=12
http://xdaforums.com/showthread.php?t=1651413
http://xdaforums.com/showthread.php?t=1497900

Thanks to kinfauns for showing me that it isn't always necessary to create an "ext2" file system first and then convert it to "ext4", and for showing me how to get rid of the pesky msftres flags.
its showing me
Error: Could not stat device /dev/block/mmcblk0 - No such file or directory.
Retry/Cancel?
help :(
 

sd_shadow

Recognized Contributor / XDA Welcome Team
Sep 21, 2011
18,989
2
10,019
South Dakota
goo.gl
Motorola Droid X
Amazon Fire
**IMPORTANT**
Read this thoroughly before you attempt any of it. The steps found herein will wipe out any data remaining on the partition for which it's used. If a partition has lost it's formatting, chances are the data is lost anyway, so there's not much more you can lose. This should be thought of as a last resort. Do not attempt this until you have tried everything else.


In many cases, just wiping the affected partition in recovery is enough to fix the problem. If not, continue reading.

If it's your sdcard that needs to be mounted, there is one thing you can try that might work in most cases.

Your computer will probably respond that the volume/device needs formatted before using it. This will erase everything left on the sdcard, as will anything else you attempt in this thread.

* Choose a quick format (if possible) and format it as "fat32", block size "4096".



If that doesn't work...


You'll have to reset your partition table, just in case (this step is optional but it doesn't hurt to do it anyway).

You'll need to be in fastboot:

(*COTR recovery doesn't have idme so you'll have to use the recovery itself to reboot into the bootloader)


Once in fastboot, enter the following commands...

With your partition table reset, it's time to print your partition table for reference.



For this, your device must be booted into recovery.


To print your partition table:

This will print the layout of your partitions 1-12. It should look something like this:



If you receive an error stating that parted can't be found, you need to find and download it and enter the following commands, or update your recovery...

(*replace "/path/to/parted" with the full path to the parted binary downloaded to your computer)


Once you have your partition table printed out, copy and save it to a text file for later use.


When looking at the partition table, pay close attention to the file systems of the system, userdata, cache and media partitions. System, data and cache, should have an "ext4" formatting, while media should have a "fat32" formatting. The partitions that are missing the proper formatting are the ones you need to focus on because they need to be removed and repartitioned.


----------------------------------------------------------------------------------------------------------------------------------------
NEVER MESS WITH ANYTHING OTHER THAN SYSTEM, DATA, CACHE AND MEDIA!!!
----------------------------------------------------------------------------------------------------------------------------------------


The following, are the steps to repartition the system, data, and cache partitions. Media (sdcard) will have it's own steps so don't get them mixed up. These same steps will be used for each of the system data and cache partitions except you'll substitute the variables (in green) with the values for that particular partition. Be careful NOT to get the any of numbers mixed up or confused or you could potentially do serious damage to your device.

The values for the previous command variables are as follows...

SYSTEM
-------------------------------
"partition_number"= 9
"directory_name" = /system
"partition_name" = system
"startblock" = 312
"endblock" = 849

DATA
-------------------------------
"partition_number"= 10
"directory_name" = /data
"partition_name" = userdata
"startblock" = 849
"endblock" = 2041

CACHE
-------------------------------
"partition_number"= 11
"directory_name" = /cache
"partition_name" = cache
"startblock" = 2041
"endblock" = 2309

For example, in order to fix the DATA partition, the commands would be written like this...

The following are the steps to repartition the media (sdcard) partition.


its showing me help :(
you are trying this on your Note 2?
 

zeddev

Member
Sep 11, 2018
29
1
[edit:] BTW This guide is for the Kindle Fire. On other devices your partition layout will likely be different. Try the forums for your particular device.

Hi, it may be a good idea to put this just above all the very specific instructions. It seemed obvious to me that they would vary and I wondered why it was presented as definitive values. Some less savvy users may get themselves in a twist if they take the values given at face value and imagine they always apply.

BTW, why is it necessary to delete and recreate a partition, instead of just reformatting it ?

thanks.
 

ElevyNJ

Senior Member
Jun 3, 2011
109
5
Not sure if anyone is still reading this

I am able to get ADB working. If I do adb shell I get
Code:
~ #

I'm trying to put it in fastboot mode so I followed these instructions

Code:
$ adb shell
~ # idme bootmode 4002
~ # reboot

But it doesn't work
issueing idmebootmod 4002 responds with <idme> write 4002 to offset 0x1000 and changes the nvram info to show

Code:
<================== idme nvram info ==================
Name            offset            value
----------------------------------|---|---|---|---|---|
serial          0x0000            D01EC0A01512119G
mac             0x0030            F0A2257037D6
sec             0x0040            UZPGKYZBJA7JXBS38E93
pcbsn           0x0060
bootmode        0x1000            4002
postmode        0x1010
bootcounter     0x1020            bf
=================== idme nvram info ==================>

from the initial settings of
Code:
<================== idme nvram info ==================
Name            offset            value
----------------------------------|---|---|---|---|---|
serial          0x0000            D01EC0A01512119G
mac             0x0030            F0A2257037D6
sec             0x0040            UZPGKYZBJA7JXBS38E93
pcbsn           0x0060
bootmode        0x1000            4000
postmode        0x1010
bootcounter     0x1020            bf
=================== idme nvram info ==================>

but when I issue the command reboot I get the reply /sbin/sh: reboot: not found


If I do ls I get
Code:
and-sec
cache
data
default.prop
dev
etc
init
init.rc
license
proc
res
root
sbin
sdcard
supersu
sys
system
tmp
ueventd.goldfish.rc
ueventd.omap4430.rc
ueventd.rc
 

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    **IMPORTANT**
    Read this thoroughly before you attempt any of it. The steps found herein will wipe out any data remaining on the partition for which it's used. If a partition has lost it's formatting, chances are the data is lost anyway, so there's not much more you can lose. This should be thought of as a last resort. Do not attempt this until you have tried everything else.


    In many cases, just wiping the affected partition in recovery is enough to fix the problem. If not, continue reading.

    If it's your sdcard that needs to be mounted, there is one thing you can try that might work in most cases.

    Code:
    [COLOR=Gray]$[/COLOR] adb shell
    [COLOR=Gray]~ #[/COLOR] echo /dev/block/mmcblk0p12 >> /sys/devices/platform/usb_mass_storage/lun0/file
    Your computer will probably respond that the volume/device needs formatted before using it. This will erase everything left on the sdcard, as will anything else you attempt in this thread.

    * Choose a quick format (if possible) and format it as "fat32", block size "4096".



    If that doesn't work...


    You'll have to reset your partition table, just in case (this step is optional but it doesn't hurt to do it anyway).

    You'll need to be in fastboot:

    Code:
    [COLOR=Gray]$[/COLOR] adb shell
    [COLOR=Gray]~ #[/COLOR] idme bootmode 4002
    [COLOR=Gray]~ #[/COLOR] reboot
    (*COTR recovery doesn't have idme so you'll have to use the recovery itself to reboot into the bootloader)


    Once in fastboot, enter the following commands...

    Code:
    [COLOR=Gray]$[/COLOR] fastboot oem format
    [COLOR=Gray]$[/COLOR] fastboot oem idme bootmode 5001
    [COLOR=Gray]$[/COLOR] fastboot reboot
    With your partition table reset, it's time to print your partition table for reference.



    For this, your device must be booted into recovery.


    To print your partition table:

    Code:
    [COLOR=Gray]$[/COLOR] adb shell
    [COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
    [COLOR=Gray](parted)[/COLOR] print
    This will print the layout of your partitions 1-12. It should look something like this:
    table.jpg


    If you receive an error stating that parted can't be found, you need to find and download it and enter the following commands, or update your recovery...

    Code:
    [COLOR=Gray]$[/COLOR] adb push /path/to/parted /sbin/parted   
    [COLOR=Gray]$[/COLOR] adb shell
    [COLOR=Gray]~ #[/COLOR] chown 0.0 /sbin/parted
    [COLOR=Gray]~ #[/COLOR] chown 755 /sbin/parted
    (*replace "/path/to/parted" with the full path to the parted binary downloaded to your computer)


    Once you have your partition table printed out, copy and save it to a text file for later use.


    When looking at the partition table, pay close attention to the file systems of the system, userdata, cache and media partitions. System, data and cache, should have an "ext4" formatting, while media should have a "fat32" formatting. The partitions that are missing the proper formatting are the ones you need to focus on because they need to be removed and repartitioned.


    ----------------------------------------------------------------------------------------------------------------------------------------
    NEVER MESS WITH ANYTHING OTHER THAN SYSTEM, DATA, CACHE AND MEDIA!!!
    ----------------------------------------------------------------------------------------------------------------------------------------


    The following, are the steps to repartition the system, data, and cache partitions. Media (sdcard) will have it's own steps so don't get them mixed up. These same steps will be used for each of the system data and cache partitions except you'll substitute the variables (in green) with the values for that particular partition. Be careful NOT to get the any of numbers mixed up or confused or you could potentially do serious damage to your device.

    Code:
    [COLOR=Gray]$[/COLOR] abd shell
    [COLOR=Gray]~ #[/COLOR] umount [COLOR=SeaGreen]"directory_name"[/COLOR]  [COLOR=Red]<---- This command is to make sure the volume isn't already mounted.  If you get an error, it just means there is no volume mounted.  Disregard.[/COLOR]
    [COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
    [COLOR=Gray](parted)[/COLOR] rm [COLOR=SeaGreen]"partition_number"[/COLOR]
    [COLOR=Gray](parted)[/COLOR] mkpart primary [COLOR=SeaGreen]"startblock" "endblock"[/COLOR]
    [COLOR=Gray](parted)[/COLOR] name [COLOR=SeaGreen]"partition_number" "partition_name"[/COLOR]
    [COLOR=Gray](parted)[/COLOR] quit
    [COLOR=Gray]~ #[/COLOR] mke2fs -t ext4 /dev/block/mmcblk0p[COLOR=SeaGreen]"partition_number"[/COLOR]
    [COLOR=Gray]~ #[/COLOR] mount [COLOR=SeaGreen]"directory_name"[/COLOR]
    The values for the previous command variables are as follows...

    SYSTEM
    -------------------------------
    "partition_number"= 9
    "directory_name" = /system
    "partition_name" = system
    "startblock" = 312
    "endblock" = 849

    DATA
    -------------------------------
    "partition_number"= 10
    "directory_name" = /data
    "partition_name" = userdata
    "startblock" = 849
    "endblock" = 2041

    CACHE
    -------------------------------
    "partition_number"= 11
    "directory_name" = /cache
    "partition_name" = cache
    "startblock" = 2041
    "endblock" = 2309

    For example, in order to fix the DATA partition, the commands would be written like this...

    Code:
    [COLOR=Gray]$[/COLOR] abd shell
    [COLOR=Gray]~ #[/COLOR] umount /data
    [COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
    [COLOR=Gray](parted)[/COLOR] rm 10
    [COLOR=Gray](parted)[/COLOR] mkpart primary 849 2041
    [COLOR=Gray](parted)[/COLOR] name 10 userdata
    [COLOR=Gray](parted)[/COLOR] quit
    [COLOR=Gray]~ #[/COLOR] mke2fs -t ext4 /dev/block/mmcblk0p10
    [COLOR=Gray]~ #[/COLOR] mount /data
    The following are the steps to repartition the media (sdcard) partition.

    Code:
    [COLOR=Gray]$[/COLOR] adb shell
    [COLOR=Gray]~ #[/COLOR] umount /sdcard    [COLOR=Red]<----Same as before.  If you receive an error on this command, just disregard it.[/COLOR]
    [COLOR=Gray]~ #[/COLOR] parted /dev/block/mmcblk0
    [COLOR=Gray](parted)[/COLOR] rm 12
    [COLOR=Gray](parted)[/COLOR] mkpartfs primary fat32 2309 7690
    [COLOR=Gray](parted)[/COLOR] rm 12
    [COLOR=Gray](parted)[/COLOR] mkpart primary 2309 7690
    [COLOR=Gray](parted)[/COLOR] name 12 media
    [COLOR=Gray](parted)[/COLOR] quit
    [COLOR=Gray]~ #[/COLOR] mount /sdcard
    Once again, any partitions on which these commands are used, will lose any data left on them, but chances are it's your only option. Pay very close attention to what you are doing and be very cautious of typos. Accidentally entering /dev/block/mmcblk0p2' instead of "/dev/block/mmcblk0p12" will brick your device, to the point of needing to pull the back cover off and shorting it...well...let's just say you don't want to have to do that.


    Afterwards you should be able to mount the effected partitions in recovery.


    Be careful, and good luck.


    Refrences:
    http://xdaforums.com/showpost.php?p=26285877&postcount=12
    http://xdaforums.com/showthread.php?t=1651413
    http://xdaforums.com/showthread.php?t=1497900

    Thanks to kinfauns for showing me that it isn't always necessary to create an "ext2" file system first and then convert it to "ext4", and for showing me how to get rid of the pesky msftres flags.
    2
    Great work, sticky and Thank You.
    1
    I didnt use this guide (although I read it all and was about to go this route) big thanks!

    Got a question though , at one point I had (i guess temp root privelidges) because I sideloaded but in root explorer I didnt have su , anyway , in KFU there was a section that said you could change mount to write , although thats nots root , would I have been able to use the adb to push commands to the kindle? I wanted to get into the file explorer and just use usb mass storage to put files in and maybe gain root that way ?

    *I realize :"That's a special kind of stupid. The kind that makes me laugh."but I thought Id ask anyway!!!

    LOL that does make me laugh, but not for reasons you'd think. Actually the USB mass storage is only the sdcard (media) partition. Mounting the sdcard to USB or side loading apps only gives you access to the sdcard, which you already have write permissions for anyway. You can't cross over to other partitions without mounting them first and you need to be the root user to do that. With the sdcard being secluded from the system partition, in order to get root permissions you need to be the root user or have write permissions on the system partition, at least temporarily.

    On the original Kindle Fire you can get that through custom recovery, which has root permissions, or through some exploit found in Gingerbread. That's what makes Pokey9000's 'fbmode' so slick. It gives users access to fastboot, which in turn gives them access to flash a custom recovery and gain root permissions (KFU uses this) long enough to write SU and Superuser.apk to the system partition, eliminating the need for an exploit in Gingerbread.

    These days, root exploits in Android are few and far between and they are getting patched pretty regularly, so the ability to install and boot onto custom recovery is pretty valuable. I imagine that's why Amazon used OMAP HS on the second generation devices in an (obviously feeble) attempt to patch such a gaping hole in their security.