[Redmi Note 8 Questions & Answers] go vegan:
Problems with Redmi Note 8 – Corruption of encrypted file systems on SD-Card

Tested with:

• Redmi Note 8 4GB, 64GB

• Redmi Note 8 4GB, 128GB

Tested with:

• Adata 128GB A1 micro SD (x2)

• Lexar 64GB 633x micro SD

• Lexar 32GB 633x micro SD

• Samsung EVO 32GB micro SD

Problem: Encrypted file system on SD-card becomes corrupted every time a large number of files are copied to it. This has been confirmed on two Redmi Note 8 phones and 6x SD cards. All SD-cards have been tested with “badblocks” and they’re working perfectly in other phones and video cameras. Cards also work fine in these phones when set up as unencrypted "portable storage".

How to verify that file-system is corrupt:

via adb:

Above screenshot shows “du” reporting 13M of storage consumed on SD-card, while “df” reports 90G of storage consumed on SD-card. This state is due to corrupted directories which cannot be removed/deleted, renamed, or populated.

The steps outlined below have been duplicated very consistently on these phones. I now own two phones that are not usable, and I’m not happy at all. How to reproduce:

1. Follow instructions here - https://c.mi.com/thread-2601107-1-0.html - [Tips] Enable Adoptable Storage On Mi Phone, or:

2. Insert an unformatted SD-card and follow the prompts to use it as adopted phone storage.

3. SD-card is now set up as encrypted & adopted storage.

4. Copy a lot of files to the SD-card. This can be done via MTP (GUI), adb “push”, using the built-in file browser’s unzip, tar, cpio, etc.

5. It makes no difference how the files are copied to the phone. The most reliable way I found to duplicate this fault is to use “adb push” to copy large music (mp3) directories to the phone. Example via abd would be similar to (but not necessarily identical to) this:

adb push ~/music/* /sdcard/Music/

6. As files are copying to phone, there may or may not be an “I/O error”. After several GBs of files are copied, there will usually be one or more corrupted directories which can not be removed/deleted, can not be renamed, can not be populated, and appears empty, but they are consuming file system space, as evident with “df”.

7. The corrupted directories are easily found with this (or similar, depending on where the files were copied to):

rm -r /sdcard/Music/

That will show “Directory not empty” error messages for corrupted directories. Using the built-in file-browser, attempting to delete these corrupt directories will result in a "Couldn't delete file" error.

8. This was first discovered on a Redmi Note 8 4GB/64GB. After testing with several cards, I thought the phone was defective. I then purchased a Redmi Note 8 4GB/128GB phone, and the same problem immediately became apparent. Is this a design flaw? Is this a hardware problem? I have reason to suspect that this is also a problem with custom ROMs, indicating that this is a hardware problem.

9. I now have two of these phones that are not working properly. A functioning file system is essential, thus I consider this a very significant problem. Xiaomi "support" is being 100% useless.

10. But wait, there's more. When attempting to do an official firmware update, the updater hangs at 99% downloading, then fails, when an adopted/encrypted SD-card is installed. Removing the SD-card from the phone does NOT resolve this issue. In order to resolve this issue, the adopted/encrypted SD-card needs to be "forgotten".

When using these phones with SD-cards set up as "portable storage", these problems can not be reproduced.

This is core functionality that's broken.

I'm not sure what to do, since returning these phones is probably not a viable option (because of shipping restrictions on phones with lithium batteries), and Xiaomi is refusing to provide any form of useful support.