How to encrypt the internal storage (not only data)? - General Questions and Answers

I have a nexus 5x device and as i understand it, encrypting encrypts /data/data, while /sdcard/ (which is a part of the internal storage) and where it links to stays unencrypted.
On the other hand i read android 6 and later can encrypt external sd-cards as adoptable storage, which can be encrypted.
The android 6 based ROM doesn't have the second option "encrypt sd-card" like some screenshots from other devices show it.
So how can i encrypt all of my nexus 5x device, not just the app data?

Your app data and internal storage are in the same partition (at /data and /data/media), so both are encrypted. /sdcard (if it exists) is just a link to /data/media/$USER (0 in case of main user), as are some other folders (like /storage).

Thank you. I was a bit confused on my new phone, but it seems that it was initially encrypted with device key (or something similiar) only and without a password. So i was just wondering how i could place my ROMs on /sdcard, when it should be encrypted.

Related

SDCARD (as internal storage) not recognized (file system corrupt?)

Hello, my device doesn't recognize my external sdcard I formatted as internal storage any more. I assume that the file system is corrupt. I tried to open it on a linux-based OS on my computer but it didn't work because the file system is (hopefully not) encrypted. As my last backup is 3 months old, it would be not so nice if I would loose all my photos I made until now.
I tried to acces it via ADB but it didn't work. Is it possible to repair the (encrypted) file system?
Thanks in advance.
if memorycard is encrypted, it will not work in any phone as normal SD card,
what we must do is .. Format as External by keeping in same phone , then memory card will work in other devices ( your data will be lost )
of course I can format it. But I like to repair the file system because I don't want to loose my data.
thirdpartycookie said:
of course I can format it. But I like to repair the file system because I don't want to loose my data.
Click to expand...
Click to collapse
No I doubt it. Only your phone will recognize the encryption and if it becomes corrupted you'll probably lose your data. That's why I also have all my photos also backup to Google Photos.
I cloned the SD with dd on my computer. I'll buy a new card tomorrow to exclude hardware reasons. If this doesn't work, I have to reformat it.
It worked!
It seemed that I had read-only acces to the card cause of hardware failure. The 1:1 copy with dd worked, even with the 16 GB partition table (new card has 32 GB). Now I'm do a big Backup at first.
thirdpartycookie: Can u please explain , it's happened samething for my internal SD card

Moto G 2015 - Photo Recovery

Hello Everyone. I have a MOTO G 3rd Gen with a 32 GB Class 10 Sandisk sdcard. I originally posted this issue on the Lenovo Forum MOTO G 3rd Gen - Photo Recovery (can't post a direct link just yet), where they suggested that I look here for advice.
I originally used my sdcard for portable storage, although I had to periodically move my photos from internal storage to the sdcard, I was satisfied with the operation of my phone. However, as I added a few apps, I started to have some issues with running out of space in internal storage IIRC.
Earlier this year, it appears that I picked up a virus, which caused Chrome to always want to open to what seemed to be a malicious page (don't recall exactly what now). I decided to do a factory reset using the Settings option to return to a clean installation of Android. I decided at that time to configure the sdcard as extended internal storage, and the process appeared to work properly.
A few months later, I started getting messages informing me that an app update failed because I had run out out storage. After some investigation, it looked like most (all?) of my apps were continuing to use the built-in internal storage rather than the sdcard's extended storage. I tried uninstalling my apps an then reinstalling them - hoping that reinstalled apps would take up residence on my sdcard but they did not. However, it looked like I had uninstalled a few too many programs and my phone lost a lot of its functionality.
One of the functions that it lost was the ability to connect to my PC with the USB cord. Another was the ability for my google contacts to sync with the phone. Yesterday, I tried everything I could thing of to back up my data but I could not figure out how to get the USB to work properly. I decided that I would do another factory reset and removed the sdcard as I knew a reset would wipe all of my data. I removed my sdcard but the factory reset through Settings did not work this time and I instead had to do a hard factory reset. My phone is now working properly with a minimal number of installed apps.
When I reinstalled my sdcard, my phone does not recognize it and wants to format both as portable and internal storage. I was hoping that it would pick up where it left off.
As a last resort, I thought I might have to format my sd card and then try to recover deleted image files. Do you have any advice about recovering the photos on my sdcard?
The last reply on the Lenovo forum was:
When you formatted the card as internal/adopted the card was encrypted amd the key was stored on the phone in a secure location. A reset has deleted the key.
Your data on the sd card is not recoverable as the card is encrypted and the key is lost.
Click to expand...
Click to collapse
Essentially, when I configured my phone to use my sdcard as extended internal storage, all I ended up with was encrypted portable storage. I would rather that there was a 3rd option for having unencrypted extended internal storage.
How would I get this into the Android developers suggestion box?
TP380Z said:
The last reply on the Lenovo forum was:
Essentially, when I configured my phone to use my sdcard as extended internal storage, all I ended up with was encrypted portable storage. I would rather that there was a 3rd option for having unencrypted extended internal storage.
How would I get this into the Android developers suggestion box?
Click to expand...
Click to collapse
No, you ended up with encrypted internal storage... The fact that you didn't understand it is the real issue.
Adopted storage is tied to not only the device, but the current installation... When an sd card is adopted as internal storage, a encryption key is generated semi-randomly and the file system is of the card becomes ext4 and encrypted, the system is decrypted automatically on boot because the key is stored in the phone. If you factory reset, it wipes your internal storage, which in this case is your sd card, and you would be fine. If you remove the card and factory reset, the key is gone forever and you have to reformat the card for it to be usable. So everything you were told in the Lenovo forums was correct, and the files are no longer recoverable by any known means.
your SD card would be nolonger useful , sorry to break this to you bro..
if your card is now encrypted state, i heavily doubt it would work again..talking of recovering photos,when encrypted.. HELL NO! it cant..
what i do is :
i always keep my memorycard as Portable, but not as internal to avoid such problems..
incase if i have formatted as internal, then while formatting or resetting.. i would take full bakup, and then Format as portable, then carryon resets..
i know these encryptions would give such a pain..
next time takecare of these issues..
suggestion: what i do is i install Googlephotos, it takes a backup of every photo & video which i have in either SDcard/internal .. so i would take necessary files while taking backup, to save time..
next time you try using GooglePhotos, it takes backup when i keep my phone in charge, (note: my internet is unlimited- so its ok for me)
acejavelin said:
No, you ended up with encrypted internal storage... The fact that you didn't understand it is the real issue..
Click to expand...
Click to collapse
Thank you for the very thoughtful reply. I thought that I understood my two sdcard formatting options but I obviously did not. When I first installed my sdcard, I selected portable storage as I did not want my sdcard to be encrypted. Only after discovering that the internal storage of my phone was inadequate for my very limited number of installed apps did I switch to encrypted adopted storage.
If I understand you correctly, the reason that the adopted storage storage is encrypted is because the internal storage is encrypted.
My expectation was that the phone would seamlessly treat the adopted storage as internal storage so I am still at a loss to understand why my phone would not automatically install apps into the available in the adopted storage.
TP380Z said:
Thank you for the very thoughtful reply. I thought that I understood my two sdcard formatting options but I obviously did not. When I first installed my sdcard, I selected portable storage as I did not want my sdcard to be encrypted. Only after discovering that the internal storage of my phone was inadequate for my very limited number of installed apps did I switch to encrypted adopted storage.
If I understand you correctly, the reason that the adopted storage storage is encrypted is because the internal storage is encrypted.
My expectation was that the phone would seamlessly treat the adopted storage as internal storage so I am still at a loss to understand why my phone would not automatically install apps into the available in the adopted storage.
Click to expand...
Click to collapse
No, anytime the SD card is adopted as internal storage it is encrypted... This is a privacy/security measure by Google and is not optional and it doesn't matter if your original internal storage was encrypted or not. Adopted storage basically brings the SD card into the "internal family" and it cannot be used elsewhere. Period (OK, yes, I know there is a way to get the encryption key and mount the volume in Linux, but it is still not perfect).
The reason it still wasn't treated as you expect is probably 2-fold... First, the Moto G3 has a tendency to miss the last step of adoption, called data migration, which is the act of moving existing data to the card and it needs to be initiated manually in many cases. Until this is done, the card is not used by Android except when you specify it because it doesn't think the card is ready yet. This can be done in Settings - Storage then selecting the 3 dot menu and Migrate Data. If this option doesn't appear or is grayed out, then the migration completed successfully (or you are using the card as portable storage, obviously).
The second reason is apps themselves... some of them have not been fully updated to the API standard used by Marshmallow and just don't honor the request to use the card as internal, and Android has a facility to allow this to happen for compatibility. It just uses the internal storage of the device so the app works. Some apps specifically request to be only on real device internal storage for whatever reason as well.
nandakis4 said:
your SD card would be nolonger useful , sorry to break this to you bro..
Click to expand...
Click to collapse
Thanks. Your sympathy is appreciated.
nandakis4 said:
if your card is now encrypted state, i heavily doubt it would work again..talking of recovering photos,when encrypted.. HELL NO! it cant..
Click to expand...
Click to collapse
I put my sdcard back in my phone just now and it did not recognize it. However, when I went to Settings > Storage and USB, I had no problem formatting it as portable storage.
nandakis4 said:
what i do is :
i always keep my memorycard as Portable, but not as internal to avoid such problems..
incase if i have formatted as internal, then while formatting or resetting.. i would take full bakup, and then Format as portable, then carryon resets..
Click to expand...
Click to collapse
I expect that this will once again cause me to have app storage space issues. I only ran into problems with data backups once I started uninstalling apps. I had hoped that uninstalling and then reinstalling apps would then cause the phone to correctly place them into adopted storage. I cannot believe that I was so careless as to not have downloaded my photos earlier but here we are.
After apparently successfully formatting my sdcard as portable storage, I went back and converted to adopted internal storage (also apparently successfully) just now. I've re-installed MS OneNote and my phone is reporting that is taking up 85.70 MB in Internal Storage. When I go to Storage and USB, I see that 44.46 MB is used of 28.32 GB of SanDisk SD Card and 3.00 GB of 4.53 GB is being used of Internal Storage. When I reinstall 63.40 MB MS Word, I see that I'm now using 2.97 GB of Internal Storage and 173 MB of SanDisk SD Card.
[As of 1:50 pm, my phone is now reporting using 3.00 GB of Internal Storage and 137 MB of SanDisk SD Card.]
It looks like adopted internal storage is working properly. I never previously suspected that there was a problem with adopted storage and installed several large apps. The storage space problem surfaced only when there was a MS OneNote update that would not install because of insufficient internal storage space.
nandakis4 said:
suggestion: what i do is i install Googlephotos, it takes a backup of every photo & video which i have in either SDcard/internal .. so i would take necessary files while taking backup, to save time..
next time you try using GooglePhotos, it takes backup when i keep my phone in charge, (note: my internet is unlimited- so its ok for me)
Click to expand...
Click to collapse
Thanks! I will try GooglePhotos. I hope I can set it up to only do backups when I'm connected to WIFI.

Get data from sd card fromatted as internal(Android 6 Marshmallow)

I have a micro sd card 32gb Transcend which I use as android internal memory and was working for one year.
Yesterday suddenly stopped working and my Motorola moto g(3rd) device not recognizing it anymore.
When i insert this card and starting my device it shows that it "checking" it for 2 minutes and then it shows "no card".
I would like to get my data from this card(photos and videos) is there a way?
I have a second moto g device to which when i insert this card it shows "cannot read card" and asks format "as internal" or "as storage"?
If i choose "as storage" i will lose my data?
Please move this post to the appropriate thread.
thanks for helping
The card was formatted as internal before it was stopped being recognized. So the card is tied to that phone and is encrypted. No matter which of the options (adoptable or portable) you choose, the second Moto G (or any other marshmallow phone) will format it first deleting all the data. I am not sure if you can recover your personal data though, sorry.
Broadcasted from Zeta Reticuli
Welcome to the joys of adopted storage... It puts incredible amounts of read/write cycles on the card, causing "early" failure. Really this is not early failure, sd cards have limited writing capabilities and using adopted storage does this causing failure.
When you use adopted storage, the data is encrypted to that device and there is a decryption token generated that is stored on the device, for whatever reason that encryption token is no longer valid (likely due to a failure of the card) and the data is lost.
Your card can no longer be trusted, I would suggest replacing it.
This is another reason why regular backups of data, both manually and automatic, are essential in devices. I suggest implementing a backup plan in the future.
acejavelin said:
Welcome to the joys of adopted storage... It puts incredible amounts of read/write cycles on the card, causing "early" failure. Really this is not early failure, sd cards have limited writing capabilities and using adopted storage does this causing failure.
When you use adopted storage, the data is encrypted to that device and there is a decryption token generated that is stored on the device, for whatever reason that encryption token is no longer valid (likely due to a failure of the card) and the data is lost.
Your card can no longer be trusted, I would suggest replacing it.
This is another reason why regular backups of data, both manually and automatic, are essential in devices. I suggest implementing a backup plan in the future.
Click to expand...
Click to collapse
Is there any application that can get this "decryption token" from device and read the sd card?
makis_g3 said:
Is there any application that can get this "decryption token" from device and read the sd card?
Click to expand...
Click to collapse
Nope. The purpose of encryption token is to prevent the use of card in other systems. It will take a great deal of hacking to get the token and put it into another phone, that too if it's possible at all. The token is randomly generated AFAIK and is not supposed to be used between different devices.
Broadcasted from Zeta Reticuli
makis_g3 said:
Is there any application that can get this "decryption token" from device and read the sd card?
Click to expand...
Click to collapse
Not really... IF (and that is a big if) the data is intact AND you are rooted already, the token can be retrieved via an ADB superuser shell, then you need to have a modern Linux installation that has a microSD card reader and you need a fair understanding of using the command line and mounting an encrypted file system manually. The big if here is if the file system is not corrupted, but if it wasn't corrupted then the phone would be able to use it. Also, if you are not already rooted (actually, your bootloader unlocked) then the process will wipe the device including the decryption token.
http://nelenkov.blogspot.com/2015/06/decrypting-android-m-adopted-storage.html
If I unistall from my device applications that used to be in sd card, is there any chance for sd card to work again?
Thanks for your replies
makis_g3 said:
If I unistall from my device applications that used to be in sd card, is there any chance for sd card to work again?
Thanks for your replies
Click to expand...
Click to collapse
No... If it can't read the card it can't use it. The fact it's checking for so long says it can do something with the card, but that operation if failing. If you are already rooted there maybe some options of manually doing an fsck but other than that the best you can hope for is to reformat the card in another device and salvage the media for non-critical usage as standard storage, but the data is lost
You could try rebooting several times, you might get lucky and it will mount by chance, but don't much hope in it.
My GF has a Moto G3 2015 (1GB RAM, 8GB storage) which I had configured with a 32GB SD-card as adoptable storage. After this month's OTA, the SD-card is no longer recognized and there seems no way to recover any of the data. It also checks a couple of minutes for the SD-card and then says 'no card'. If I put the card in an adapter and a Windows pc, it says the card is healthy in disk management but it does not show the card in Explorer, I guess due to the formatting and encryption.
This is the second time her phone has issues with adoptable storage. First time the internal storage was full while there was still plenty of room on the SD-card, but this was apparently because I had only configured the SD-card as adoptable storage after 6 months of use, which caused the internal storage to have filled first. I expected adoptable storage to treat the internal storage and SD-card as one, but this is not true. I gave the phone a factory reset and immediately set the SD-card to adoptable storage before installing any apps, this took care of the problem until now.
I would not recommend using this option on any phone. Just buy a phone with enough storage and use the SD-card as external storage which is what I do on my Honor 7. I had told her to wait for the 2GB/16GB version which was going to be released a couple of months later but you know women, once they have their mind on something, they can't wait .

How to prevent Android 11 from using the SD card?

Dear all,
the following problem might be unusual and the opposite of what other people want, but as the title says:
Is it possible to prevent Android 11 (and custom ROMs based on it) from writing to the external SD card? That is, I don't want apps or the O/S itself to store any data there. You now probably are asking yourself whether I have gone totally crazy, putting an external SD card into the phone and not wanting it to be used, so I'll give a bit of background:
I have a Samsung S9 plus Duos (G965F/DS) and have installed a custom recovery (TWRP 3.5.2) and a custom ROM (ArrowOS 11) onto it. Then I have installed SSHelper 13.2 and have put an external SD card into the phone.
I am taking backups very seriously. I don't want to root my phone, but nevertheless want bit-for-bit backups of all partitions or data, respectively. I don't have much data on the phone, but the data and the O/S configuration I *do* have must be regularly backed up no matter what. The backup must *not* be in the cloud. That led me to the following idea for the backup process:
- Boot into TWRP
- Let TWRP make the backup, using the partitions of the internal storage as source, and using the external SD card as destination
- Reboot to system
- Fire up SSHelper
- Copy the backup from the external SD card to a PC, e.g. via WinSCP.
That process works like a charm; I have done it several times.
[ Side note: The SSHelper / WinSCP combo is ingenious. It enables me to transfer data (e.g. backups) between my PC and my phone without involving the cloud and without having to pull out the external SD card all the time. Doing the latter every other day would probably damage the phone or the external SD card quite fast. ]
Now I have only one small problem left: Android itself of course recognizes the external SD card as well and installs a folder structure on it (e.g. Downloads, Movies, Pictures etc.). Although I actually haven't seen files (other than placeholders) in there yet, I have no clue if and under which circumstances apps or the O/S might put important data in these external SD card folders. I have to prevent the latter, because it would render my backup method (backup internal storage completely to external SD card) useless.
Hence the question: Is there a method to tell the O/S and all apps that they may read the external SD card, but under no circumstances must place data there?
Thank you very much in advance for any ideas!
P.S. I have seen many threads where users had problems with the external SD card, e.g. not being able to make apps use it or not being able to see its contents. But I somehow have the opposite problem: Of course, I need to see the external SD card's contents (which is no problem), but I want to prevent normal apps and the O/S from writing something there.
No you can't prevent android from creating default folders on it, but I'm pretty sure you can exclude them from backup.
Thank you very much!
However, excluding these folders from backup wouldn't be wise if Android or an app would have put data in them ...
D9yHyi8Fe3mo1YgM said:
Thank you very much!
However, excluding these folders from backup wouldn't be wise if Android or an app would have put data in them ...
Click to expand...
Click to collapse
Then don't exclude the whole Android folder, just some folders inside. Like /obb folder or system apps data inside /data
Or just exclude "LOST" or other cache folders.
D9yHyi8Fe3mo1YgM said:
Dear all
Is it possible to prevent Android 11 (and custom ROMs based on it) from writing to an SD card? That is, I don't want apps or the O/S itself to store any data there.
Click to expand...
Click to collapse
Assuming you are speaking of an External SD-card ( Note: As with Android internal storage memory by default is named SD-card ).
As long as you don't use an external SD-card ( completely or partially ) as Adoptable Storage by default neither apps nor OS itself write to it ( store data on it ).
@jwoegerbauer Thank you very much! This what I have experienced, too. I have seen the folders, but no data in them. I am still wondering why it creates those folders at all if it doesn't put data in them.
I eventually have missed it, but I think I have gone through every option of ArrowOS, but didn't find a menu item where I could activate (or inactivate) the external SD card as adoptable storage. Therefore I suspected it would do that automatically, depending on circumstances.
Another mystery (for me) is that (AFAIK) data would go into subfolders of the "Android" folder on the external SD card. But the Android folder is nearly empty, while the rest of the folder structure (Documents, Pictures etc.) is at the root level of the external SD card (i.e. at the same level as the "Android" folder).
P.S. Yes, I was speaking of the external SD card. I'll check if it's still possible to edit my posts and make that clear.
Thank you very much again!
XDHx86 said:
Then don't exclude the whole Android folder, just some folders inside. Like /obb folder or system apps data inside /data
Or just exclude "LOST" or other cache folders.
Click to expand...
Click to collapse
Thank you very much again!
I should have made myself more clear: My plan is to have all data only in internal storage and to back up internal storage to the external SD card.
When there is normal data (besides these backups) on the external SD card, three problems arise:
1) The normal data on the external SD card takes up space. If I can't control which data Android and the apps put there, the remaining space may not be sufficient for the backups one day.
Every portion of normal data which is on the external SD card counts twice in that sense. First, it increases the backup size by its own size; secondly, it reduces the space which remains for the backups by its own size.
2) I know that I wrote that I will transfer the backups to a PC wirelessly. However, I still want the phone to run normally even after I have removed the external SD card. If Android or the apps put normal data on the external SD card, this is not possible any more.
3) Excluding certain data on the external SD card from backup is problematic and would void the main advantage of my backup strategy:
I really don't need to think about what to exclude or include. I just back up all internal partitions, completely and bit by bit, to the external SD card. If I lose the phone, I can buy another one, flash TWRP onto it, restore those backups, and have the original O/S, apps and all data, and even dm-verify will be no issue.
I have no clue about Android and I am not able (or would be too lazy anyway) to decide which data to include or exclude to achieve the same. So I really would like to avoid that triage.
I believe that some time ago I had found an ugly trick to keep Android and the apps from creating and using those folders. I'll have to check whether I have taken notes about it ...
Thank you very much again!
@D9yHyi8Fe3mo1YgM
To clarify things:
You have to distinguish between portable storage and adoptable storage. Adoptable storage really extends device's internal storage, whereas portable storage does not.
If apps are granted WRITE_EXTERNAL_STORAGE / READ_EXTERNAL_STORAGE permission then they can access the external SD-card, too.
jwoegerbauer said:
You have to distinguish between portable storage and adoptable storage. Adoptable storage really extends device's internal storage, whereas portable storage does not.
Click to expand...
Click to collapse
Thank you very much again! I suspected so, but didn't find the setting in the UI of ArrowOS yet. I am nearly sure that I just missed it, and will research again (just out of curiosity, because extending the internal storage to the external SD card is exactly the opposite of what I want).
jwoegerbauer said:
If apps are granted WRITE_EXTERNAL_STORAGE / READ_EXTERNAL_STORAGE permission then they can access the external SD-card, too.
Click to expand...
Click to collapse
I see. Thank you very much for the explanation. I'll go through the app permissions and check that. Then only the O/S itself could put data there.
[ Side note: In the meanwhile, I have corrected my posts according to your hint regarding the term "SD card". ]
I don't know if this topic has aged or not, have you found any solution?
I don't want Android system to write files like Android-Podcast-Alarms-Music-Notification into my sd card, I want my sd card to be clear and clean
this order system which android uses is very useless and annoying, when will they remove that??!!

[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!

Categories

Resources