Adopted Storage sd card corrupted - builtin fsck.f2fs? - Android Q&A, Help & Troubleshooting

Hi,
I have been running lineage and cyanogenmod on an S4 mini for a long time/4 years. Once in a while the SD cards formatted as adopted storage get the corrupted message. I have used Samsung and Sandisk, usually bought from the manufacturer or amazon, so I hope it was not fake sd cards.
I usually have copied them and then just used the new one. In the past some of them were really wrecked, for example the write to it was successful, but the files gone after reboot, so the sd card controller pretended it was working, no write errors, but the write actually did not work. I proved this by using touch in the twrp terminal to create a file and checking it after reboot. Reading was fine and recovery of the files (whole card) was possible by using ddrescue. Of course I have used twrp to get the encryption key and mounted it with losetup and dmsetup on Ubuntu.
However this time I replaced the sd card again and copied it but had a look at the old sd card, where lineage claimed it was corrupt. It turned out, that the f2fs had some errors. Now I wonder if there is anything I can do about it without being root or mount the sd card on a PC. Is there a builtin fsck.f2fs in android/lineage?
What causes android to think that the sd card is corrupt?
During copy of another earlier used sd card I found that the read process did stall a couple of times for 10 seconds, but I am not sure if it was because of ddrescue writing to disk or if indeed there is a hardware problem with the sd card. On the other hand, it was working fine under twrp without any problems accessing files or writing to it/copying files.
Is there any internal timer in android, that e.g. after 3 seconds the card is not responding to write/read request it is treated as corrupt?
It would really be great if there was an check option that runs fsck.f2fs, as of today, one only gets the reformat option on a corrupted sd card.
Thanks in advance for any comments.
Denis.

I think I found it by myself, something probably has caused the SD Card to set the PERM_WRITE_PROTECT bit in the CSD structure of the SD card. But the sd card corrupted message is somewhat missleading in that context.
Furthermore I did not have messages like this when looking at dmesg:
c0 mmc0: cmd 55 response timeout error
c1 mmc0: PERM_WRITE_PROTECT was set.
In addition there seem to be internal health checks in sd cards that cause the PERM_WRITE_PROTECT bit to be set, like:
If either offset[8] or offset[9] increases to 64h, the card goes to read-only state. Then, a
WRITE operation attempt on the card returns failure with the WP_VIOLATION (bit26 in
status register) error bit set. Meanwhile, the PERM_WRITE_PROTECT bit in the CSD register
is set, indicating permanent protection against overwriting or erasing the entire
card.
Taken from the Micron document TN-SD-02: Enabling Memory Card Health Monitor System Introduction
So the copying procedure and using a new card is the only way to deal with such issues.
Thanks, Denis.

Related

formatting mmc

can anyone please tell me how to format mmc card for xda...there's 3 options in win xp ...fat32....fat...ntfs....i cant format it from the xda , keep getting error code 31.....an error occurred while formatting the storage card folder...........thanks
Try formatting to Fat or Fat 32, however if the xda wont format it there may be a problem, make sure the "lock" switch is in the off position. I have had a problem with sd cards before, what I did was a sd backup from the xda, it then seemed to work ok, just deleted the backup and it worked ever after.
theres no lock switch on the mmc card...i've tried storage tools and flash format...the card must be buggered
i have a different problem, but im sure its connected to the formatting somehow! my card only fills up HALF way!
there is 40% more room availble, all scans prooves this, yet i cant add anything to it, im thinking, its the way its formated, was there a 'directory' limit to how many files that can exist in root?
and wasnt it related to the type of formatting? so my question is...
which format/cluster/ect... is best to fully use a 256 card? and 512/1G.?
Hello,
I actually started a topic last week concerning the same thing. i'm copying bits and pieces of it here; it also helps address your concern about which format to use and the sd card limitations. the first point below address which format you should use for the sd card; in this case use FAT. by the way, i use an sd-card reader (usb plugged) to format the card; it shows up as "removable disk e" in my laptop's window's explorer.
1) i'm using a 512 mb card; i was having some difficulty because the memory of the card would only go up to around 300. at first i thought there was a problem with the card itself so i had to constantly erase the contents to make mp3s, files, pics, mpegs, etc fit. then i stumbled upon the pc command for formatting disks; there were 3 options to format the sd card: FAT, NTFS and FAT32. when i used fat32; the behavior was the same and the memory usage would only go up to 300 max. when using ntfs; my xda2 refused to recognie the card (it wouldn't show up in the explorer app). when i formatted using FAT, everything was great. i can now use the sd card to it's limits and am no longer restricted to the 300-mb trouble i was having.
question: what's the difference in the 3 formats? i don't really know but obviously using FAT format was the best thing to do, but what's with the other formats?
2 cents worth.
cheers mates
robson
thanks Robson...but i have sent to back for a replacement....i tried it in my reader but the pc could not see the sd card...so i went out and bought a 128mb card while i wait for the new one to come....had no problems with the 128 worked straight away
thanks for the tip - from now on FAT is to be my solution
one more thing to add, I do have 256MB SD card on my XDA I and WM2003, ver 4.0.21
I can use my 256MB card to the full limit, the card has been formatted with CnetX format utility (www.cnetx.com) with FAT16 and FAT32 and apart from the fact that content has been missing from time to time, so I had to re-load the files ... when I locked the card, everything is fine now
regards,
monika
today I have tested sandisk 512MB SD card ....
I am allowed to fill it up to the full limit of roughly 484MB
I am curious about the other thing .... buying 512MB SD card for its prce it's almost a rip-off and you get only 484MB in return, I remember old times back with IPAQ + PCMCIA sleeve with inserted flash card 1280MB of sandisk - the size written on the back of the card WAS EXACTLY matching what PPC2002 was showing .... 1280MB
to me it seems like either different "disk geometry" or disk format - can anyone explain it to me pls
regards,
monika

[Q] Unmounting with console commands

Hello
I own a Samsung I8262 (Galaxy Core) and an 8GB microsd card. The card was previously formatted for usage with Link2SD for my old device. I now want to just format it and make it one fat32 8GB partition, but I am facing problems. In short: the HP USB Disk formatting tool says the device is write protected, even though it is not, Partition Magic's Mini Tool says the whole card is "bad", giving no options for actions, Windows' disk tool claims it is constantly busy, gParted gets stuck before even managing to detect any disks, and OpenSUSE's standard disk tool gives a ridiculous sounding error about wrong block size. As a last resort, I decided to try Aparted on Android with the card in the phone. It keeps claiming the card is still mounted even after I have unmounted it from "Settings". After closer examination in Terminal Emulator, I noticed mount says that some block device (/dev/block/vold/179:33) is still mounted in the folder for the external sd card. So, I am trying to unmount it from the terminal, but even with proper syntax, and superuser permissions, I get "failed: Invalid parameter". I am ready to write this card off as a goner, but since it is less then a year old, I was hoping someone might present another solution.
Thanks in advance for any input.

[Q] How to Format SD Card as Internal Storage?

I'm running low on internal storage, and also want to enable full-device encryption. The obvious solution is to format the SD Card as "Internal Storage" which in theory lets you move some apps and their data to a partition on the SD Card, while also allowing that partition to be encrypted.
That all sounds great, so I read a half-dozen blogs on how to do this. They all start with "insert the SD Card and choose Set Up." But even if I reformat the card or wipe the partition table completely, the only option I get is "format as portable storage" and never see any set up screen or option to pick internal storage. Am I missing something? Do I need to format the sd card on my desktop as a specific partition type? Do I need to run some adb incantation to enable the option? Is it just not an option in OOS 3.1.4 and I need to install a different ROM?
Eventually answered my own question. Basically, OnePlus disabled the feature, probably because the system is extremely fragile and confusing to users. However, it is possible to enable the feature via adb, using
Code:
adb shell sm set-force-adoptable true
Even then, while the option appeared, phone phone itself had all sorts of problems trying to format the SD Card:
- I could wipe the SD Card, insert it into the phone, format it (as external storage), and then be unable to format it a second time. Buh? Apparently android's external sdcard formatter is capable of screwing up the GPT/MBR distinction in such a way that it can't cope with formatting a card that it formatted itself?
- If I wiped the SD Card, inserted it into the phone and selected to format it as internal storage, it would format to 20%, stop, wait 180 seconds, and then time out, leaving me with a corrupted SD Card that required re-wiping. This is probably related to the first problem - the timeout is because the 'format internal' happens in a second thread, which ran into a similar error about GPT/MBR problems and then the parent thread didn't capture the error or do anything useful with it.
Finally, I tried doing the whole thing in adb, following instructions here: http://blog.sam.liddicott.com/2016/02/android-6-semi-adopted-storage.html
But even then, I ran into the timeout problem when trying to format mixed (50%), until I popped the card out, nuked all existing partitions, inserted the card and immediately started the adb process. Basically, if android's formatted ever touches the SD Card, it is screwed up until it is wiped again.
In the end, this process worked:
- Pop the card out of the phone, put it into a card reader, use MiniTool Partition Wizard Free to delete all partitions, wipe the partition table and set the card to GPT. Don't convert from MBR to GPT, wipe it until you get an option to put a completely fresh GPT table on.
- Pop the card into the phone. Do not touch any of the phone's menus - they are there to temp you into screwing the card up again.
- Connect the phone to computer via usb.
- Run:
Code:
adb shell sm list-disks adoptable
to get the sd card name. It'll be something like disk:179:128 but it will change every time you wipe it.
- Once you have the disk name, run
Code:
adb shell sm partition $DISKNAME mixed 50
but substitute your own disk name and what percentage of the sd card you want to use for external. If you don't want to use any, I think you do something like
Code:
adb shell sm partition $DISKNAME private
but I'm not sure.
So yeah, this is a complete mess and I understand why OnePlus didn't want to subject their users to it.
I recommend don't use adoptable storage, it's not worthed. Better use foldermount apps to move apps data from internal to ext. storage.
I want to do full-device encryption, including (most) of the apps data. Is there a better way to accomplish this without accepting the 16GB internal storage limit?
I wouldn't recommend ever using adoptable storage on the OPX. OnePlus used an incredibly slow microSD reader and it shows.

Adoptable Storage went wrong, issues trying to revert

Greetings and Salutations,
I have a Samsung Galaxy J7 running the stock ROM and bootloader, Android 6.0.1, Kernel 3.10.49-9058927, with 16GB internal storage, and a 128GB U3 microSD card (not 100% sure of SD card speed, its above class 10), the phone is the 2016 version (subtle changes from the 2015 apparently) and has not yet been rooted.
I tried to enable adoptable storage to get a couple of apps to run better, but I want to revert back and seek a different solution, namely rooting and using Link2SD.
I tried the standard method of adoptable storage, and the option was not present in the storage screen on my phone. I tried using adb, and got timeout messages on the sm partition disk:179,64 private command. (Enabled USB debugging, accepted connections, installed samsung drivers, adb server daemon and shell all started successfully). Eventually it showed the sd card as corrupt. I popped it out of the phone, and deleted the partition on my computer, leaving raw, unformatted space on the card. I reinstalled the sd card in the phone, and the format as internal option was now present. I hit that, let it run and tried to migrate data afterward. Migrating always failed between 30 and 45%, and it showed me at 15.92GB or more out of 16GB used. I decided to revert back. I reformatted the sd card as portable in the phone, and it corrupted again. I did the same process, but elected to format as fat32 on my computer. Reinserting the sd card, it asked to format, so I did, as portable. The sd card appears to be back to normal, but I'm still at almost 16GB used on the phone. I tried to delete some music files that I have on the SD card as well, and they won't delete from the internal memory. It always says "could not delete" or "Delete operation failed". I have used the built in file manager, ES file explorer, and I believe I tried on my computer last night (it was getting late, but I remember at least trying). All fail to delete the files. I'm down to very few apps, none can be moved to the SD card, and I can't move much data otherwise. I harbor a suspicion that some hidden files are present on the internal memory, but I could be paranoid. I'm hoping to avoid a factory reset, but I fear that's the only option. I have a backup of the sd card, but not the phone's internals beyond what google saves in the cloud. I'm open to suggestions, and thanks in advance.
~Nick

Unsupported SD card. Can't format.

I ought a new Samsung EVO+ SD card for the Tab S3 but the Tab doesn't want to know about it.
The card is original. I verified size and speeds. Exactly as package describes. But once I stick the SD card in. It says Unsupported SD card and asks me to format it for portable storage. When I do this the bar doesn't go beyond 20% and it gives me an error. The numbers change but most stays the same.
command'14 volume partition disk:179,64 public' failed with '400 14 Command failed'
it totally doesn't make sense to me at all. Googling the middle numbers brings me to other brands with faulty SD card slots or motherboard issues.. I'm a bit afraid now...
What I tried:
reformatting the card in exfat different cluster sizes.
checked for errors in windows
upgraded latest oreo firmware (obviously)
did a factory reset on tablet
cleaned SD slot with air
I have no clue what's going on but I'm afraid I need to send it back. But before I do it I'd thought I'd ask here if anyone had a similar issue before.

Categories

Resources