du -s reports different size for identical directories in internal memory and SD—Noug - Android Software/Hacking General [Developers Only]

I'm on Nougat, 7.1.1, Samsung Note 8.
If I copy a directory from the internal storage to the Micro SD card, du then gives me different sizes for these two dirs.
For instance, I created a small test directory with files in the internal storage , for which “du -s” gives me a size of 1992. I copy it to the SD in the terminal, I get a size of 2560. Now I copy the directory from the SD to another location in the internal directory—now the size is again 1992.
Same behavior when this is done in the terminal in TWRP.
I'd think it's a bad card, but the sizes are consistent—I'm gonna check later on a GNU PC, new card too, seems to be working no problem.
But I've never seen behavior like this before…
Any ideas, or is this some well known phenomenon that I'm ignorant of?

Related

Mounting Internal Storage vs. SD Card - USB

With the Evo, connected to my PC, selecting "Mount as disk drive," only the Micro SD card appears in Windows Explorer as a directory. I want and expect to see another directory for Internal Storage.
Had had the Incredible, where _both_ the SD card and Internal Storage appeared as two separate directories. I could see what was stored on ea.
I am under 300MB of memory of avail. space on the Internal - lots of posts about running out of app room in various forums - so curious what media and other data is there, what might be movable to SD card.
Got some further questions about how to copy data from an 8MB card to a 32MB card (just drag to PC and back?) as I just ordered one, and about how to tell certain apps where I want media recorded to (may simply not be an option w Camcorder and others), but mainly just want to understand how to view Internal storage from a directory on my PC when unit is docked. Thx!

[Q] How is internal memory allocated?

How is the 16Gb of internal flash memory allocated for various purposes in these phones? It looks to me like about 12Gb is used for "USB storage", or in other words the file system that appears under the /sdcard directory (not counting any actual external card that may be present.
Is the other 4Gb then handled as directly-addressable memory for storage of apps and their internal data storage? I also assume that if you go into the Applications list and select "Move to SD Card" for an app, it actually just moves it from one part of the 16Gb internal memory to another -- is that correct?
As an Android developer, this caused a lot of confusion when the original Galaxy was released, as it essentially had what appeared as both an internal and optional external SD card. But at the Android API level, a call to getExternalStorageDirectory points you to the /sdcard directory, which is actually internal to the device!

Can't access data of external SD after larger file transfers

hi,
i'm using wifi file transfer pro to transfer files from/to my pc. i store my movies and other larger files on the external sd card (sandisk ultra 32GB uhs-1) because of I/O lag.
but after transferring some larger amount of data the external sd card is not accessible anymore until i reinsert it. i was able to copy one 300MB file, the other 300MB file was cut off at about 200MB. sometimes it's possible to transfer larger amounts of data, sometimes no problem at all.
the file system browsers on the tablet still show the files with correct size and let me browse through the directories, but i can't access any files anymore until the sd card is removed.
anyone else having this weird issue? no idea if it's the app or something else, but such file transfers shouldn't kill the sdcard.
What filesystem are you using on this card? Hopefully not NTFS?
no, i'm using fat32 as linux is my main OS and ntfs is always a pain there i guess i have to try to reproduce it again with logcat running.
Might be some problems with uhs-1 support, as it seems to work well for some under the .26 firmware and somewhat worse for others. In fact, logcat might be useful (although I'm not sure if I should say "good luck with reproducing it" ;>)

FolderMount or other means to mount external SD dirs on internal /sdcard

There seems to be quite a bit of discussion about this but no real resolution. I've been trying to find a way to mount directories on my external SD card onto the internal /sdcard directories to force apps that only can write to /sdcard internally to actually write to the external card. What a mess. I've tried symbolic links, battled the FUSE mounts, experimented with "mount -o bind" -- on and on. FolderMount claims to do such things, but bricks the phone.
I can do the bind mounts -- and when I look at them with adb they appear to be correct. But the apps continue to write to the internal /sdcard dirs. I've also turned off SuperSu mount namespace separation in testing.
It's a shame that something that really should be so simple is such a PITA. Any new ideas? Thanks!
Why don't you use ADB and partition your SD card as internal storage. Samsung took out the adoptable storage feature for Marshmallow. For the workaround go here:
http://forum.xda-developers.com/galaxy-s7/how-to/enable-adoptable-storage-s7-t3333511
I considered that early on. The problem is that I've never seen a reasonable explanation of how "bonded" memory like that is handled. Right now I have a 64GB card split as one exFAT and one ext2 partition (the latter for link2sd, and mostly empty). But at least this lets me have some control over where apps end up. But if I bond ("adaptable") an SD card partition to the internal memory, I (AFAIK) lose that control. Any given app and app's data could end up on faster internal memory or slower external memory, and I wouldn't be able to control it. Also, at this point wiping the phone to do this would be a serious PITA. Am I missing something? Thanks!
Actually, you can partition part of the SD card as internal and part of it can remain external using the ADB method. I have a 64GB card myself, and it works great. I would recommend a high speed one though.

How to manage the limited internal memory of a smartphone with whatsapp

Hi, I have an old Redmi6A phone (Lineage OS 17.1) that only has 8GB of internal memory. This is very little if you use Whatsapp. Of course I added a 32Gb SD card, but with whatsapp I have trouble saving my photos on the card. What are the possible workarounds?
1- Is there a difference depending on whether you set the SD card as portable storage or internal storage?
2 - My phone is rooted. I've looked for practical solutions including magisk, but no module matches.
3 - Beyond whatsapp, what should I do: is there an app that allows other apps to be installed on the external media? Is this a good idea? Is it better to limit the storage of data on the SD card to avoid the crash of these "deported" apps?
Just an advice or two would make me happy...
If Android device allows to make external SD-card part of internal storage memory ( keyword: Adoptable Storage ) then you are good. Check it.
I believe that my android device allows me to do this. The French translation does not use the words adoptable storage "stockage adoptable" but the 1st drawing seems to match.
What I have read on the subject indicates that the reading and access time to the data on the external card is much longer than on the internal memory. How does android arbitrate what it stores on the internal or external memory? Can the user control this?
I assume and hope that the most crucial apps are on the internal memory
It's on you how much of the SD-card's storage memory ( in % ) you'll add to internal memory: 1,2,...,100.
Yes, reading / writing to device's "portable memory" basically takes longer. So with regards to file transfer speeds, choosing the right memory card is crucial. Look here:
The best SD cards for 2023: top memory cards for your camera
We've tested and ranked all of the best SD cards you can buy
www.techradar.com
Android by default uses device's internal memory. The least app's allow to store their data on external SD-card: this is set by app's developer.
I tested the 2 options; first the adoptable storage but for some reason it didn't work; I mean the operation was correctly done but the 32Gb was not added to my internal memory; just a few hundred Mb more. I repeated the operation 3 times to rule out the possibility of an isolated incident.
So I was forced to reformat the SD card as external memory. Everything went well. But now I'm back to the original situation.
My search led me to 2 apps (Link2SD and App2SD) to override the restriction to move to the SD card. Those apps don't seem to be really used anymore: their peak corresponds to the 2015-2016 versions of Android (Marschmallow and Nougat) and are quite complex to handle since you have to format the external SD card in several partitions to be able to consider moving anything.
What do you think about this type of solution?
As @xXx yYy already said:
The least app's allow to store their data on external SD-card: this is set by app's developer.
Click to expand...
Click to collapse
Thus forget the named 3rd-party-tools that claim they can.
BTW: look inside here
Whatsapp folder in Android: Here's where to find it
WhatsApp folder with all media files in Android can be found on new location if you are on Android 11. Learn here where to find it.
mobileinternist.com
Napafroi said:
I tested the 2 options; first the adoptable storage but for some reason it didn't work; I mean the operation was correctly done but the 32Gb was not added to my internal memory; just a few hundred Mb more. I repeated the operation 3 times to rule out the possibility of an isolated incident.
So I was forced to reformat the SD card as external memory. Everything went well. But now I'm back to the original situation
Click to expand...
Click to collapse
After an external memory got converted to portable memory it's Android what automatically moves data from internal memory to portable memory as long as they moveable to gain internal memory space. Thus the few 100MB you reported.
You always can configure the amount of portable memory indeed to be used by Android's Storage Manager ( SM ) using ADB.
Well, I think I'm getting used to this adoptable storage which is really confusing since the size doesn't take into account the extra 32Gb (in the storage manager and also in solid explorer).
I don't know if it's a bug but sd maid and its memory analysis function allows me to check that telegram, osmand (including downloadable maps) and vivaldi browser will install directly on the adaptable storage. That's all I ask.
It's still surprising not to be able to view the content of the SD card; maybe it's a bug like others have experienced like on this thread
I wanted to experiment a nandroid backup on MicroSD adopted-storage with TWRP which was refused.
xXx yYy said:
You always can configure the amount of portable memory indeed to be used by Android's Storage Manager ( SM ) using ADB.
Click to expand...
Click to collapse
So I understand better the interest to calibrate the portion of adoptable storage...
Screenshot no. 5 shows 2.7 GB of the portable memory ( real capacity 31 GB ) are used.
To get the whole portable memory as internal memory used using ADB try this
Code:
adb shell
sm list-disks -> This cmd returns id of SD-card e.g. 179:160
sm partition disk:179:160 private -> Here you use the id of SD-card
where the numbers are the Android's name of your disk.
I just did this.
Reboot but it didn't change anything. Maybe the card is defective...
EDIT : oh wait, yesterday I inserted this same micro SDcard in an old samsung galaxy tab4 with the "same" custom rom (LineageOS 17.10) as adoptable storage. The 32Gb capacity was not added to internal memory as well. Maybe this rom is buggy for managing adoptable storage.
Sorry for my english
The ( meanwhile outdated ) Lineage OS 17.1 - a Lineage OS 17.10 probably doesn't exist - is based on Android 10 and can "Adoptable Storage" as you initially confirmed.
IMO you are probably doing things wrong
"migrate data" is the 2nd necessary step after 1st step "adoptable-storage" is created. It will ( try to ) move all apps from phone into SD-card ( if app is moveable ), means all new installed apps will directly get installed into SD-card as long as android:installLocation="auto" is defined in app's AndroidManifest.xml.
When 100% disk space got adopted you can't see your SD-card any longer, the only way to check disk usage is from Android's cmd line running df -h /mnt/expand/* ( if Android is rooted consider 3rd party apps like Link2SD instead ).

Categories

Resources