/sdcard problems after upgrading Android

danarama

Senior Member
Aug 22, 2010
31,288
18,810
0
Oxenhope, West Yorkshire, UK
I'm seeing a few posts and qquestions about this with the latest Lollipop release being upon us.

There are several issues here and I wanted to write a quick note aboyut them both for you

1) You cannot SEE your /sdcard data after updating to lollipop

Cause:

Some strange difference between L and KK, where /storage/emulated and /data/media are not "alligned"

Fix:

Open a terminal emulator application and enter the following 2 line command (Press enter after each line)

Code:
su
restorecon -FR /data/media/0
Reboot

2) You have lost permissions to /sdcard


Cause:

You restored all your sdcard data using adb push or MTP whilst booted into recovery. IT screws up your permissions. These methods are fine for single files or backups that you waant to flash or restore, but as soon as you start pushing folders, this issue will be seen

Fix:

In a root explorer app, browse to /data/media/0 and locate your Download folder. Set the permissions for all on Download to read / write (Long press the Download folder > permissions)
Download and flash THIS ZIP from the thread below.


[TOOLS][ZIPS][SCRIPTS] osm0sis' Odds and Ends [Multiple Devices/Platforms] (by @osm0sis)

You can also download the zip to a computer and adb push it / MTP via recovery

3) 32 GB device shows the storage of 16 GB version

Cause:

Unknown. This has actually been happening since the Nexus 5 was released

Fix:

Wipe cache and data

4) TWRP backups are missing

Cause:

This is really unknown. We're not even sure that this can be fixed. Some say its a TWRP bug but that cannot be proven.

Sometimes backup folder is empty....

Fix:

Multiple things you can try. Some have to use restorecon command but usually that has to be done after every backup.

Others have just flashed the factory images

Some of us have never had issues so its hard to call it a bug, but there is definitely something funky going on here.


Other times, backups shows as an unknown file type, 0bytes in size. I haven't a specific fix as I have had no feedback from anyone who has fixed it. You could try deleting that unknown file then running the fix above.

Also, please update to TWRP 2.8.3.0

5) All I see in /sdcard is 0 folder

Cause:

Well known issue on /data/media/0 devices - which is the location of the /sdcard. Unsure of the cause on Nexus 5 though

Fix:

/sdcard is in /data/media/0. If you see a 0 folder in /sdcard, you're actually seeing /data/media/0/0.

To fix, just move /data/media/0/0/* to /data/media/0
 
Last edited:

alen1901

Senior Member
Jan 29, 2011
5,800
7,215
0
I updated without a problem. Be sure to update to latest SDK and to wipe sdcard, eg. clean install.

Sent from Pure Nexus 5
 

Mairo

Senior Member
Feb 28, 2013
558
139
43
I have used always Mixplorer and now after flashing 5.0 I cant see nothing under /root. Why so? Something with root permissions? everything else is ok. ( I want to modify build.prop a little )
do I need use some other file explorer?
 

alen1901

Senior Member
Jan 29, 2011
5,800
7,215
0
Yep, the first issue is fine if you wipe your /sdcard.

The second one is caused by restoring your sdcard afterwards
I restored everything except data and android folders back to sdcard, i even restored obb files and no problems at all. It is the best practice for users to restore only their data, not the ones android creates itself. Im sure most people just selects everything and transfer to pc/stick, then copy everything back.

Sent from Pure Nexus 5
 

vnvman

Senior Member
Oct 31, 2009
2,167
245
0
Alba
I'm facing some serious issues today with this.
At first I encountered the issue when installing the flashable update. The OP suggested to execute few command lines in a terminal emulator, but it would only have worked if you rooted your device with cfroot. So I tried to re-root with cfroot with no luck: it kept saying already unlocked. At this point in the settings said I had 3/3 free gigs of storage. Out of desperation I tried to flash every single part of the stock image via fastboot, and re-do the procedure with cfroot and all. However after doing all of that I ended up with 12/12 free gigs, which is what I'm left with right now. I also tried to fix the permissions either with the root explorer app and by flashing the the provided fix, but nothing has happened. No traces of either Titanium backups or whatever files I had before on my storage, it's basically like a new phone with a blank 12 gb storage (keep in mind I have the 32 gb version). I really don't know what to do at this point anymore. Have I by any mean flashed the partitions of a 16 gb variant or something? Will I ever be able to get my storage back? Any help wuld be much appreciated.


Update: apparently I also flashed userdata so my phone believed to be a 16 gb unit. A data wipe fixed it. Obviously my storage is gone but that's my bad, I'll be more careful before udating next time.
 
Last edited:

danarama

Senior Member
Aug 22, 2010
31,288
18,810
0
Oxenhope, West Yorkshire, UK
I'm facing some serious issues today with this.
At first I encountered the issue when installing the flashable update. The OP suggested to execute few command lines in a terminal emulator, but it would only have worked if you rooted your device with cfroot. So I tried to re-root with cfroot with no luck: it kept saying already unlocked. At this point in the settings said I had 3/3 free gigs of storage. Out of desperation I tried to flash every single part of the stock image via fastboot, and re-do the procedure with cfroot and all. However after doing all of that I ended up with 12/12 free gigs, which is what I'm left with right now. I also tried to fix the permissions either with the root explorer app and by flashing the the provided fix, but nothing has happened. No traces of either Titanium backups or whatever files I had before on my storage, it's basically like a new phone with a blank 12 gb storage (keep in mind I have the 32 gb version). I really don't know what to do at this point anymore. Have I by any mean flashed the partitions of a 16 gb variant or something? Will I ever be able to get my storage back? Any help wuld be much appreciated.


Update: apparently I also flashed userdata so my phone believed to be a 16 gb unit. A data wipe fixed it. Obviously my storage is gone but that's my bad, I'll be more careful before udating next time.
Yeah that's a different but common issue.
 

RVDigital

Senior Member
Feb 17, 2010
466
272
0
heymanniceblog.com
Hey thanks for this post. I've been through this issue like 3 times and keep forgetting about restorecon.

On that note, I was getting the following output:

~ # restorecon -FR /data/media/0/
restorecon: invalid option -- F
The fix appears to work without the "F" flag. Do you know why this is not a valid flag?

According to a general rundown of restorecon, the "F" flag does the following:

-F
Force reset of context to match file_context for customizable files, and the default file context, changing the user, role, range portion as well as the type.
 

danarama

Senior Member
Aug 22, 2010
31,288
18,810
0
Oxenhope, West Yorkshire, UK
Hey thanks for this post. I've been through this issue like 3 times and keep forgetting about restorecon.

On that note, I was getting the following output:



The fix appears to work without the "F" flag. Do you know why this is not a valid flag?

According to a general rundown of restorecon, the "F" flag does the following:
Not sure but glancing at the Dev preview thread, some had success with this:

restorecon -r /data/media/0/*
 

vaindil

Senior Member
Jun 26, 2013
190
103
0
Tried both, all that happened is that /sdcard is now blank. /data/media/0 still lists all of the files, but /sdcard itself is empty or unlinked or something. I unfortunately don't know which of the two steps did it.
 

krazeecracker

Senior Member
Jul 7, 2012
2,089
1,661
0
Florida
Quick question, I'm currently on slimkat and plan on clean flashing tonight via bigxies ROM. With this method of fixing the SD card, I won't lose all my data as far as downloads, pictures, etc.?
 

tomp100

Member
Nov 13, 2014
11
0
0
Please explain your issue.
Essentially, the phone doesn't think it has an SD card. When i click on SD card in root browser, it is empty. Items that were on the SD card in 4.4.4 are now located in data/media/0/0 , and I am unable to move these items to SD. Also, if I try to dowload sonething off the internet, I get a "no SD card" message.
 

RVDigital

Senior Member
Feb 17, 2010
466
272
0
heymanniceblog.com
I can confirm that my issues were caused by importing my backed up /SDCard/ data via an "adb push" while in recovery.

If doing the same while the phone is booted into system, permissions are set appropriately and no further action is required.

Thanks again for this post!
 
  • Like
Reactions: tatnai