{FIX} "Can't write on SD / Insert SD card" after wiping /sdcard


Aug 20, 2013
550
199
80
#1
Disclaimer:
Use on your own caution! I take no responsibility for lost data or coming zombies! Always perform backup!

Instructions:
1) Download and run: https://play.google.com/store/apps/details?id=jackpal.androidterm
2) type in terminal following commands:
Code:
su
Code:
chown media_rw:media_rw /mnt/media_rw/sdcard0
Code:
chmod 755 /mnt/media_rw/sdcard0
4) reboot
DONE!
 
Oct 10, 2013
2
0
21
#2
Thank you very much. Did as explained and it "free" my sdcard, now I can download and take pictures.
Maybe just to update, the phone must be rooted before starting this procedure.
 
Jun 28, 2014
204
76
52
#3
When i run "chown media_rw:media_rw /mnt/media_rw/sdcard0" i'm getting "unknown user/group media_rw:media_rw"
I've got trouble getting my windows 8.1 laptop recognizing my sdcard in mtp mode, it doesn't show on file explorer.It only works in ptp mode.I've got drivers installed.Is that fix related to my problem or applies only for phone recognizing sdcard?I run pacman-rc3 with khaon kernel but it doesn't seem related cause i had this with different combos.
 
Jul 24, 2013
66
18
18
#5
Disclaimer:
Use on your own caution! I take no responsibility for lost data or coming zombies! Always perform backup!

Instructions:
1) Download and run: https://play.google.com/store/apps/details?id=jackpal.androidterm
2) type in terminal following commands:
Code:
su
Code:
chown media_rw:media_rw /mnt/media_rw/sdcard0
Code:
chmod 755 /mnt/media_rw/sdcard0
4) reboot
DONE!
I'm on CM11 having the same problem that I can't write on the sd-card anymore. Trying your commands on the built-in terminal or via "adb shell" I get that error message:

Code:
Unable to chown /mnt/media_rw/sdcard0/: Read-only file system
Any idea how to solve that?
 
Jul 24, 2013
66
18
18
#7
Well I use ES Explorer which should have the same possibilities I hope. It shows me that the permissions are already set as you indicated above ... this is the output from my adb shell

Code:
shell@aries:/ $ su
root@aries:/ # cd /mnt/
root@aries:/mnt # ll
drwxr-xr-x root     system            2014-11-26 09:37 asec
drwxrwxr-x root     system            2014-11-26 09:36 fuse
drwx------ media_rw media_rw          2014-11-26 09:36 media_rw
drwxr-xr-x root     system            2014-11-26 09:36 obb
lrwxrwxrwx root     root              2014-11-26 09:36 sdcard -> /storage/sdcard0
drwx------ root     root              2014-11-26 09:36 secure
drwx------ shell    shell             2014-11-26 09:36 shell
lrwxrwxrwx root     root              2014-11-26 09:36 usbdisk -> /storage/usbdisk
root@aries:/mnt # ll media_rw/
drwxrwxr-x media_rw media_rw          2014-11-25 08:18 sdcard0
drwx------ media_rw media_rw          2014-11-26 09:36 usbdisk
Does that look OK?
 
Aug 20, 2013
550
199
80
#8
Code:
root@aries:/ # su
su
root@aries:/ # cd /mnt
cd /mnt
root@aries:/mnt # ll
ll
drwxr-xr-x root    system            2014-11-23 02:00 asec
drwx------ media_rw media_rw          2014-11-23 02:00 media_rw
drwxr-xr-x root    system            2014-11-23 02:00 obb
lrwxrwxrwx root    root              2014-11-23 02:00 sdcard -> /storage/sdcard
0
drwx------ root    root              2014-11-23 02:00 secure
drwx------ shell    shell            2014-11-23 02:00 shell
lrwxrwxrwx root    root              2014-11-23 02:00 usbdisk -> /storage/usbdi
sk
root@aries:/mnt # ll media_rw/
ll media_rw/
drwxr-xr-x media_rw media_rw          2014-11-25 21:05 sdcard0
drwx------ media_rw media_rw          2014-11-23 02:00 usbdisk
root@aries:/mnt #
 
Jul 24, 2013
66
18
18
#9
Hmm - I don't see a fuse mount at your side ... could that be the source of the changed permissions? I'm really wondering what chaused that change of permissions ... :confused:o_O
 
Jul 24, 2013
66
18
18
#14
And last try: Boot into CWM, set up ADB and run:

chown media_rw:media_rw /mnt/media_rw/sdcard0
chmod 755 /mnt/media_rw/sdcard0

and reboot. If it's not working I found this http://forum.xda-developers.com/showthread.php?t=2222297
Thanks for all the time you're willing to invest to help me!

I looked into /system/etc/permissions/platform.xml and I see this
Code:
    <permission name="android.permission.READ_EXTERNAL_STORAGE" >
        <group gid="sdcard_r" />
    </permission>

    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
        <group gid="sdcard_r" />
        <group gid="sdcard_rw" />
    </permission>

    <permission name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" >
        <group gid="sdcard_r" />
        <group gid="sdcard_rw" />
        <group gid="sdcard_all" />
    </permission>

    <permission name="android.permission.WRITE_MEDIA_STORAGE" >
        <group gid="media_rw" />
    </permission>
As you've seen above /mnt/media_rw/sdcard0 is already owned by media_rw:media_rw ... perhaps I should change that to sdcard_rw? And /storage/sdcard0 shows root:sdcard_rw as owner with 775 permissions

Executing the chown and chmod commands via adb is not possible since the filesystem is read-only :-/
 
Aug 21, 2013
21
0
11
#20
i used aries core unified single partition resize from @M1cha and it works. the problem is, i can't take a picture due to something wrong about internal storage. it can't save pictures taken, can't download files, but it can install apps from playstore.
it can also copy files from MTP mode.

did i miss something?
 
Jun 30, 2014
49
26
38
#21
Hi! Got some problems on my mi2s (32gb) running mokee44.
I made some mistakes, such as freezing some system apps, but when I tried to disable tdb and wipe data/format system and sd, re-flashing everything, the sd has not been formatted, my syst2 is stuck on bootloop and couldn't find the gapps installed (and can't re-downloaded or else). I restored a previously made backup and all works as it should, but still my syst2 and sd should not be there or as it should be.

Later today with my boyfriend I'll try running Android Terminal Emulator and check the sd for damaged sectors.. But what could I do to fix those problems? :(
 
Last edited:

M1cha

Members
May 29, 2011
1,747
2,839
297
#22
i used aries core unified single partition resize from @M1cha and it works. the problem is, i can't take a picture due to something wrong about internal storage. it can't save pictures taken, can't download files, but it can install apps from playstore.
it can also copy files from MTP mode.

did i miss something?
did you recreate all filesystems? also, which ROM are you using?
 
Likes: MSephiroth

M1cha

Members
May 29, 2011
1,747
2,839
297
#23
Hi! Got some problems on my mi2s (32gb) running mokee44.
I made some mistakes, such as freezing some system apps, but when I tried to disable tdb and wipe data/format system and sd, re-flashing everything, the sd has not been formatted, my syst2 is stuck on bootloop and I couldn't find the gapps installed (and can't re-downloaded or else). I restored a previously made backup and all works as it should, but still my syst2 and sd should not be there or as it should be.

Later today with my boyfriend I'll try running Android Terminal Emulator and check the sd for damaged sectors.. But what could I do to fix those problems? :(
well using TDB isn't a good idea these days because many ROM's just don't support it at all.
You should install TWRP, recreate all filesystems, and install your favorite ROM again.(backup and restore data if that's important, but if your installation is broken that could lead to bootloops again).
 
Jun 30, 2014
49
26
38
#24
Yep, I disabled tdb for this reason but I don't like LolliPop so much. I'll search for upgraded news on mokee50-51. I don't think my installation is broken, I think there are problems on the internal memory. But flashing a new recovery is in the to-do list.

EllyG81 Using Tapatalk on Xiaomi Mi2S
 
Last edited: