[How to Guide] Moving data files after Android 11 to the external sdcard - Android General

Many people install apps on the internal storage where those apps have large amounts of data that most people wish to store on the external sdcard, but on Android 11, Google changed the associated external sdcard storage access APIs available to app developers.
This change has caused problems for users of a variety of tools such as OsmAnd~, Total Commander, MapFactor Navigator, HereWeGo Maps, etc., where I just went through the process and want to document it so that others can follow the steps more easily than it took me to figure it out just now.
What I'll do below is document with detailed screenshots the steps I used to migrate the OsmAnd~ map data from non-rooted Android 12 internal storage (where map data is stored by default) to the external sdcard storage.
These are the basic steps as documented in the OsmAnd FAQ.
Go to Settings (on the start screen) --> OsmAnd Settings --> Data storage folder
Change the value to a path pointing to the external SD card, on many Android systems it may contain /storage/extSdCard or similar.
Please note that some versions of Android strictly limit your choice of which path will be write-accessible for apps.
You are then asked if the contents of the OsmAnd data folder should be moved from internal memory to the external SD card.
You may also perform this manually using a built-in file manager app on the device, or via connecting the device to a computer as external storage and performing the move from there.
Following _those_ directions, it seemed to work fine to move my OsmAnd~ 313.26MB of data storage from my internal sdcard to my external sdcard.
OLD: External storage 1
/storage/emulated/0/Android/data/net.osmand.plus/files
NEW: External storage 2
/storage/0000-0001/Android/data/net.osmand.plus/files
Here are the screenshots of that migration process:
First I updated OsmAnd~ to 4.1.11
Then I checked the OsmAnd~ Data storage folder settings
I then migrated the data using the OsmAnd~ Move to ext sdcard command
This moved the internal map data to the external sdcard
I doublechecked using the X-plore file manager
Which showed a path of /storage/0000-0001/Android/data/net.osmand.plus/files
Which were also mounted over Wi-Fi onto the Windows 10 PC as a drive letter
Showing that the files were successfully migrated to the external sdcard
And which Windows adb clearly shows over Wi-Fi using "shell" commands
The Windows drive letter which is the entire Android 12 sdcard, was mounted
over Wi-Fi using the native Windows 10 "NET USE" command, as follows:
C:\> net use Z: \\[email protected]\DavWWWRoot /USER:foobar snafu
Where "foobar" is an arbitrary username set up for read/write in the WebDav server running on Android, and "snafu" is the arbitrary password for it.​
Note: The Android 12 phone doesn't have any login account whatsoever & the Windows 10 PC has a username that is different, & which has no password.​
The Windows adb commands I just now used for that screenshot were these:
1. This shows the Android phone is connected over Wi-Fi via tcp.
C:\> adb devices
adb-serialnumber._adb-tls-connect._tcp. device​
2. This shows Windows adb can read the internal Android storage over Wi-Fi.
C:\> adb shell ls /storage/emulated/0/Android/data/net.osmand.plus
cache​
files​
C:\> adb shell ls /storage/emulated/0/Android/data/net.osmand.plus/files
tiles​
tracks​
3. This shows Windows adb can read the external Android storage over Wi-Fi.
C:\> adb shell ls /storage/0000-0001/Android/data/net.osmand.plus/files
Us_california_san-francisco_northamerica.obf​
World_basemap_mini.obf​
backup​
favourites.gpx​
fonts​
ind.cache​
itinerary.gpx​
regions.ocbf​
rendering​
roads​
routing​
sounds​
tiles​
tracks​
travel​
voice​
In summary, the screenshots I created show the process graphically that I followed just now with the FOSS OsmAnd~ app to recover from the changes Google made in Android 11 and up to the storage model for apps saving data onto the external sdcard. As far as I know, the recovery process for similar apps should use similar steps.
Please let me know if you need more information about how this was done as I'm trying to help others by documenting these steps.
Note:
The phone is an unrooted Android 12 Samsung Galaxy A32-5G with both an internal storage card /storage/emulated/0 and an external storage card /storage/0000-0001 (where the external sdcard was formatted with that easy-to-remember 0000-0001 identifier years ago using a Windows PC).

Related

[Q]

How to open .asec file on my samsung galaxy s i9000 ?
The ASEC file extension is associated with the Google Android operating system. Android from version 2.2 Froyo supports installation of applications to memory card. Applications moved to memory card are encrypted and use ASEC file extension. ASEC files can be found in .android_secure folder saved on memory card.
Applications stored in ASEC encrypted file format cannot be modified by other applications installed in phone, or computer. Applications installed on SD card are paired with Android phone, where they have been installed. It is not possible to put SD card to other Android phone and run applications installed on SD card.
Only Android SDK Emulator that is a part of Android SDK Tools is able to run applications installed on SD card in ASEC encrypted format, if the Android phone with SD card is connected to the computer.
If you move application back from SD card to phone's local storage, Android also decrypted ASEC package file to standard APK application package.
I hope this helps.
Source: http://www.file-extensions.org/asec-file-extension
YoursTruly98 said:
The ASEC file extension is associated with the Google Android operating system. Android from version 2.2 Froyo supports installation of applications to memory card. Applications moved to memory card are encrypted and use ASEC file extension. ASEC files can be found in .android_secure folder saved on memory card.
Applications stored in ASEC encrypted file format cannot be modified by other applications installed in phone, or computer. Applications installed on SD card are paired with Android phone, where they have been installed. It is not possible to put SD card to other Android phone and run applications installed on SD card.
Only Android SDK Emulator that is a part of Android SDK Tools is able to run applications installed on SD card in ASEC encrypted format, if the Android phone with SD card is connected to the computer.
If you move application back from SD card to phone's local storage, Android also decrypted ASEC package file to standard APK application package.
I hope this helps.
Source: http://www.file-extensions.org/asec-file-extension
Click to expand...
Click to collapse
how can i open and edit the content please???
tunjicool said:
how can i open and edit the content please???
Click to expand...
Click to collapse
You need the key which you can find here /data/misc/systemkeys/AppsOnSD.sks
If the app has already been decrypted by the system, you should find the apk file in /mnt/asec/APPNAME.
Otherwise proceed as follows.
Read the key with the unix command
Code:
od -t x1 AppsOnSD.sks
Output should be something like
Code:
ab cd 12 34 56 ab cd 12 34 ab cd 12 34 09 47 a1
Now log into your phone via adb and mount the app by following these steps:
Code:
adb shell
vdc asec list #should output all asec apps
vdc asec mount org.foopackage-1 abcd123456abcd1234abcd12340947a1 1000 #1000 is the system UID
Now the app should be mounted and can be found in /mnt/asec/APPNAME
See this blog for more detailed information: nelenkov blogspot using-app-encryption-in-jelly-bean
Sorry, link was disabled, so just ask google for the blog.
tuxware said:
You need the key which you can find here /data/misc/systemkeys/AppsOnSD.sks
If the app has already been decrypted by the system, you should find the apk file in /mnt/asec/APPNAME.
Otherwise proceed as follows.
Read the key with the unix command
Code:
od -t x1 AppsOnSD.sks
Output should be something like
Code:
ab cd 12 34 56 ab cd 12 34 ab cd 12 34 09 47 a1
Now log into your phone via adb and mount the app by following these steps:
Code:
adb shell
vdc asec list #should output all asec apps
vdc asec mount org.foopackage-1 abcd123456abcd1234abcd12340947a1 1000 #1000 is the system UID
Now the app should be mounted and can be found in /mnt/asec/APPNAME
See this blog for more detailed information: nelenkov blogspot using-app-encryption-in-jelly-bean
Sorry, link was disabled, so just ask google for the blog.
Click to expand...
Click to collapse
What if you have lost the keys? I've recently did a dirty backup of my S7 Edge before flashing a new ROM, and didn't know that I needed to save the keys in /data/misc/systemkeys/AppsOnSD.sks. I may have lost that file permanently, unless by some strange magic it was backed up somewhere that the factory reset didn't touch. How can I open the ASEC files now?
To be perfectly clear, I don't intend to promote piracy. I had bought some of the apps from Google Play. I know the ASEC files have them, but I can't access them on the device. I need some way to break the encryption so that I can move the apps and their data back to their respective folders.

Adoptable storage and apps updates move back the app in the internal storage

I have Android 6.0 non-rooted and installed my sdcard as internal storage (adoptable storage). I can move a lot of apps to the sdcard but as soon as these apps gets updated, the app move back to the internal storage. I thought that adoptable storage was there to say to android to use the sdcard by default!
I have searched the web and found a few blogs that explain how to tell Android that the sdcard as the default location but the command cannot be executed on my MotoG3 for security reason.
Code:
adb shell pm set-install-location 2
and i get
Code:
Error: java.lang.SecurityException: Package android does not belong to 2000
is there any other trick so the apps that are on the sdcard stay there for good?
I've gotten into a habit of moving them back after an update. I would guess that since the SD card is encrypted the app can't install directly to the SD if the app is designed to install to internal. This is what Motorola says
"Play Store will install applications on either storage volume automatically, based on a set of rules provided by the application developer."
Sent from my SM-T530NU using XDA-Developers mobile app

[Q] broken filesystem on sdcard

Hello
I'm looking for some help on repairing a broken filesystem on a sdcard. There is a popular issue with the Redmi Note 8T that is corrupting the filesystem when copying a lot of files to the sdcard. Technical details and questions below.
The sdcard is a 128GB Sandisk Extereme card. It's encrypted (used as Adoptable Storage), the phone has still the decryption key, so when I insert the card it shows files and directories. Before the crash there was around 100GB of data on the sdcard. Now it has only 2,8GB of used storage (for most of the time - explenation below).
I've made a dd copy of the card and copied it to a larger 256GB card and a 512GB pendrive. Both starages connected to the phone (over usb, microcard reader) are giving the same result - the files and directories are decrypted, but the filesystem is corrupted. When I insert the sdcard into the phone and check the capacity, it shows that there is -6126312313/128GB of used space. After couple of minutes, the number changes to ~100GB/128GB or to 2,8GB/128GB (which is 95% of times).
Actually only one directory is corrupted the "Camera" directory. This one had previously around 95GB of pictures. When entering over MTP protocol and trieng to open this directory, it show's an error releted with bad directory size, entering over adb shell allows to enter it, but it's empty. Over adb it also shows that its size is 120KB. But there aren't any files inside the directory.
The phone of course isn't rooted and the bootloader is locked. Android 10 on board.
I'm looking for help, or any kind of idea on how to access the images in the Camera direcotry - and couple of questions below.
1. Is there any way to fsck over adb without root?
2. Can I access the decryption key on the phone? And decrypt the partitions on linux?
3. Can the sdcard be decrypted? And if yes - will it delete the decryption key after that?
4. Can I make a dd/binary copy of the card over adb and save it (looking for a way to fsck the filesystem on linux, but for that I need a full decrypted copy of the card)?
5. Is there a known app that could repair a broken filesystem?
6. Can the phone be rooted without loosing the decryption key? The phone doesn't need to be functional after that. If accesing the directory means breaking the phone - I'll go for it.
7. Any other ideas are very welcome, will give a try on anything.
And a final one - are there any other places on the internet (except xda) where I could ask for help which I'm not aware off?
Thanks!

Can you mount BOTH Android internal & external storage onto Windows as a drive letter over Wi-Fi using a SINGLE WebDAV server?

Can you mount BOTH Android internal & external storage onto Windows as a drive letter over Wi-Fi using a SINGLE WebDAV server?
This works:
1. I can easily mount my Android INTERNAL storage (including the read-only root hierarchy!) on Windows using any free WebDAV server and the Windows "net use" command over Wi-Fi to make that half of Android a drive letter.
WebDav Android Home Directory: /
[This gives read access to root at / and read/write access to internal storage at /storage/emulated/0]
Windows Mount Command: net use Y: \\[email protected]\DavWWWRoot /USER:username password
This works:
2. At the same time, I can just as easily mount my Android EXTERNAL storage (i.e., the entire external sd card) on Windows using any second free WebDAV server and the Windows "net use" command over Wi-Fi to make that other half of Android a different drive letter.
WebDav Android Home Directory: /storage/0000-0001
[This gives read/write access to external storage at /storage/0000-0001]
Windows Mount Command: net use Z: \\[email protected]\DavWWWRoot /USER:username password
This fails:
3. But I can't seem to get just one WebDAV server to mount ALL of android (the root file system, plus read/write on the internal sdcard and read/write on the external sdcard) as a single Windows drive letter using that single WebDAV server over Wi-Fi.
WebDav Android Home Directory: /
[I believe this should access to the entire Android phone but it doesn't. Why not?]
Windows Mount Command: net use Z: \\[email protected] /USER:username password
My questions are:
a. Can you mount the entire Android phone (all three partitions) onto Windows over Wi-Fi as a single drive letter using a single WebDav server?
b. If so, how did you do it?
c. Why can't I?
Details:
My phone is Android 12; not rooted; Samsung Galaxy A32-5G; & the free WebDav servers I'm using are:
a. WebDAV Server, by The Olive Tree, Free, +ads, requires gsf, rated 3.5, 100K+ installs
b. WebDAV Server - BestDAV by ZQ Software, Free, ad free, gsf free, rated 3.4, 10K+ installs
GalaxyA325G said:
Can you mount BOTH Android internal & external storage onto Windows as a drive letter over Wi-Fi using a SINGLE WebDAV server?
This works:
1. I can easily mount my Android INTERNAL storage (including the read-only root hierarchy!) on Windows using any free WebDAV server and the Windows "net use" command over Wi-Fi to make that half of Android a drive letter.
WebDav Android Home Directory: /
[This gives read access to root at / and read/write access to internal storage at /storage/emulated/0]
Windows Mount Command: net use Y: \\[email protected]\DavWWWRoot /USER:username password
This works:
2. At the same time, I can just as easily mount my Android EXTERNAL storage (i.e., the entire external sd card) on Windows using any second free WebDAV server and the Windows "net use" command over Wi-Fi to make that other half of Android a different drive letter.
WebDav Android Home Directory: /storage/0000-0001
[This gives read/write access to external storage at /storage/0000-0001]
Windows Mount Command: net use Z: \\[email protected]\DavWWWRoot /USER:username password
This fails:
3. But I can't seem to get just one WebDAV server to mount ALL of android (the root file system, plus read/write on the internal sdcard and read/write on the external sdcard) as a single Windows drive letter using that single WebDAV server over Wi-Fi.
WebDav Android Home Directory: /
[I believe this should access to the entire Android phone but it doesn't. Why not?]
Windows Mount Command: net use Z: \\[email protected] /USER:username password
My questions are:
a. Can you mount the entire Android phone (all three partitions) onto Windows over Wi-Fi as a single drive letter using a single WebDav server?
b. If so, how did you do it?
c. Why can't I?
Details:
My phone is Android 12; not rooted; Samsung Galaxy A32-5G; & the free WebDav servers I'm using are:
a. WebDAV Server, by The Olive Tree, Free, +ads, requires gsf, rated 3.5, 100K+ installs
b. WebDAV Server - BestDAV by ZQ Software, Free, ad free, gsf free, rated 3.4, 10K+ installs
Click to expand...
Click to collapse
They can be displayed as separate drives but not as a single drive unless you have the adoptable storage option set up on your device, in that case, it would see your internal and external as a single integrated drive. One thing to note when using adoptable storage, the device will not boot with the sdcard removed.
There are also apps like Link2SD for rooted devices that can partition a portion of your external sdcard and use it as if it were part of the system partition so that you can move system apps to that partition even if your device would not normally allow you to move those apps to external sdcard. A couple of things to note about using such a partition as if it were part of the system partition, the moved apps will load and operate slower and the device won't boot without the external sdcard inserted or can even brick the device if the linked partition or external sdcard becomes corrupted.
Droidriven said:
They can be displayed as separate drives but not as a single drive unless you have the adoptable storage option set up on your device....
Click to expand...
Click to collapse
Thank you for explaining why the "internal storage" (both / and /sdcard/) have to be one mount point while my external storage sdcard (named /storage/0000-0001/) has to be a second separate mount point.
The good news is that with two webdav servers, they can each be mounted as a drive letter each over onto Windows over Wi-Fi.
Droidriven said:
There are also apps like Link2SD for rooted devices that can partition a portion of your external sdcard and use it as if it were part of the system partition
Click to expand...
Click to collapse
Thanks for that advice but I'm not rooted and T-Mobile still owns the phone (as they gave it to me for free) so I think they've disabled rooting.
The one problem that remains is I don't seem to have WRITE permission at the TOP LEVEL of the external sdcard from Windows over Wi-Fi when the external storage sdcard (named /storage/0000-0001/) is mounted as a drive letter onto Windows.
Strangely enough, using Windows with the sdcard mounted as a drive letter, I can write to any directory on that external sdcard that I had created on the phone (e.g., /storage/0000-0001/0001/) but I can't write to the top level of that external sdcard itself (i.e., /storage/0000-0001/).
I haven't debugged that write-permission problem yet as I was trying first to mount both the internal storage and external storage as a single Windows drive letter.
GalaxyA325G said:
Thank you for explaining why the "internal storage" (both / and /sdcard/) have to be one mount point while my external storage sdcard (named /storage/0000-0001/) has to be a second separate mount point.
The good news is that with two webdav servers, they can each be mounted as a drive letter each over onto Windows over Wi-Fi.
Thanks for that advice but I'm not rooted and T-Mobile still owns the phone (as they gave it to me for free) so I think they've disabled rooting.
The one problem that remains is I don't seem to have WRITE permission at the TOP LEVEL of the external sdcard from Windows over Wi-Fi when the external storage sdcard (named /storage/0000-0001/) is mounted as a drive letter onto Windows.
Strangely enough, using Windows with the sdcard mounted as a drive letter, I can write to any directory on that external sdcard that I had created on the phone (e.g., /storage/0000-0001/0001/) but I can't write to the top level of that external sdcard itself (i.e., /storage/0000-0001/).
I haven't debugged that write-permission problem yet as I was trying first to mount both the internal storage and external storage as a single Windows drive letter.
Click to expand...
Click to collapse
I'm not familiar with connectivity and drive protocols with what you're doing as I've never had the need for such a process.
I'm not even sure what to look up in order to get familiar enough to troubleshoot your setup.
Also, your attachments can't be viewed correctly, the attachment feature here is quirky. It is better to upload your photos to an image hosting site and then link them here.
Droidriven said:
I'm not familiar with connectivity and drive protocols with what you're doing as I've never had the need for such a process.
Click to expand...
Click to collapse
No problem. I've used ALL the freeware servers & clients on Android to interface with Windows, and I've found that WebDav works the best since it mounts Android as a drive letter over Wi-Fi.
To be clear, Ferro's FTPUse will also (supposedly) mount Android as a Windows drive letter over Wi-Fi but I find FTPUse even more problematic than WebDAV is.
Also of course SMB/Cifs/Samba "should" work best with Windows, but an unrooted Android phone can't use port 445 while Windows insists on serving SMB shares on port 445 (so all you can use are SMB clients on unrooted Android and not the SMB servers).
There are other connection methods (e.g., libmtp, kdeconnect, nitroshare, etc.), but I find WebDav to be the easiest and most functional in my tests over the years.
Droidriven said:
I'm not even sure what to look up in order to get familiar enough to troubleshoot your setup.
Click to expand...
Click to collapse
No problem. Currently I run two commands and that mounts everything; but I was just wondering why I can't do it with one.
a. I can mount the internal storage (including / & /sdcard)
b. I can mount the external storage (/storage/0000-0001)
I was hoping someone else would try it on another phone so that we can compare results. It's a very powerful feature to be able to save directly to Windows from Android and vice versa.
Droidriven said:
Also, your attachments can't be viewed correctly, the attachment feature here is quirky. It is better to upload your photos to an image hosting site and then link them here.
Click to expand...
Click to collapse
Sorry about that. Here are the images posted to an image site.
Both sdcards mounted
Permissions are the same
My Files has permission
File Manager has permission
X-plore has no permission
WebDav has no sd permission
Let me know if the images show up more easily that way as I normally include them but I'm all for making life easier for folks to see them.
I found one Android app - file manager+. Seems buggy but beautifully do the integration before being automatically disconnected. Maybe my network setup has something to do I'm not sure.
This thread is great! I'm trying to repurpose an old Samsung Galaxy Tab A tablet as a network drive on my home network. Ive been able to get BestDAV and WebDAV running on the tablet...but both give access to only the root directory of the tablet. I want the external SDCARD to be visible. Ive tried to specify this in the Website home directory setting, but Im clearly doing something wrong........can anyone help with the correct setting? Many thanks!!!

External storage (micro sd) Permission issue in Android 12

Solid Explorer app. Android 12
I want to copy/move files between internal and micro sd stoeage. So when I want to copy from internal to micro sd, it says to grant permission. When I select root of external storage (Android 12) , the button labeled "USE THIS FOLDER" is disabled but tapping it anyway just says "to protect your privacy, choose another folder" and I can't choose external storage root but if I choose a folder in micro sd, it says I chose/selected to grant a wrong folder.
I have tried other file managers in play store even google's own app. They just not able to copy or move to micro sd without giving detailed reason for the error.
How do I grant this permission so I can move files to micro sd?
Which device? Scoped storage is wonderful... not.
blackhawk said:
Which device? Scoped storage is wonderful... not.
Click to expand...
Click to collapse
Mi max 3 with Android 12 custom rom
How do I fix this permission so I can use my micro sd normally?
sgn15 said:
Mi max 3 with Android 12 custom rom
How do I fix this permission so I can use my micro sd normally?
Click to expand...
Click to collapse
No clue for a custom rom. Try a Google search with xda included to pull up threads about work arounds here on other systems using scoped storage. Scoped storage is quit the terror especially in Android 13.
Google never liked expandable storage as they want to make you a slave to cloud, just like MS.
These may be useful to you:
Managing files in the "Android/data" folder on Android 11 (without root or USB) : r/Android
**EDIT (8/19/2022):** Android 13 has, unfortunately, restricted access to the /Android/data and /Android/obb folders aga
teddit.net
https://www.google.com/amp/s/blog.e...-28-file-manager-loophole-closed-73891524/amp/
Only apps make used of scoped storage in Android 10+: You always can opt-out scoped storage.
Set requestLegacyExternalStorage in app's AndroidManifest.xml to true.
xXx yYy said:
Only apps make used of scoped storage in Android 10+: You always can opt-out scoped storage.
Set requestLegacyExternalStorage in app's AndroidManifest.xml to true.
Click to expand...
Click to collapse
I just checked and it is already set to true.
Edit: any other solutions?
If I'm right you want to copy so-called shareable MEDIA files ( i.e. images, audio files, videos) from Android's internal SD-card to plugged in external SD-card what basically requires READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE and MANAGE_EXTERNAL_STORRAGE permissions if in Android 10+.
For shareable media content, shared storage is used so that other apps can access the content for where all permissions are required if in Android 9 and lower.
This all is handled by Android's MediaStore API. So teach yourself about this.
This issue is ridiculous and dumb.
I don't want to root my device JUST TO MOVE MY SAVEGAME FILE TO MY SD CARD.
Android is getting more like iOS, isolationism.
Anyway, the only way to do this is using laptop and usb cable + USB debugging, dang it.

Categories

Resources