Finding the exact location of a text messaging database on Xiaomi smartphones is often a necessity when trying to recover lost correspondence or transfer contacts to a new device. Unlike photos or documents, SMS messages do not appear in a standard file manager as normal files that are available for viewing. Android, and in particular the shell MIUI or HyperOS, hides this information in secure system partitions, access to which is limited by the rights of the superuser.
Understanding the storage structure not only allows you to properly organize backup, but also to avoid losing important information when resetting. Many users mistakenly believe that messages are in the SMS folder on the visible partition of memory, but this is not the case. Real storage is a specialized SQLite database that is constantly updated by the operating system in the background.
In this article, we will discuss in detail where exactly the message file is physically located, how to access it with root rights and without them, and also consider Xiaomiβs regular tools for synchronization.
System architecture of message storage on Xiaomi
The Android operating system uses a centralized approach to storing application data, and the messaging service is no exception. On all Xiaomi devices, regardless of the shell version, the main database file is located in a hidden system partition. The path to it always begins with the root directory /data/, which is closed by default to user access without Root rights.
The specific path to the file is: /data/data/com.android.providers.telephony/databases/mmssms.db. This file contains the entire history of incoming and outgoing messages, including senders, time of receipt and delivery status. It is important to understand that direct copying of this file on a working phone without special utilities can lead to damage to the database, since the system constantly writes to it.
β οΈ Note: Direct deletion or editing of the mmsms.db file through the root-access file manager can lead to the complete disappearance of all SMS and the inability to receive new messages before reinstalling the system.
In addition to the main database file, the same directory can contain the log files mmssms.db-wal and mmssms.db-shm. They are used by the WAL (Write-Ahead Logging) mechanism to ensure data integrity in the event of a sudden power outage or application failure.
Why can't you just copy the database file?
Access to the file system: Root rights and ADB
To directly extract the file mmssms.db user must have superuser rights. On Xiaomi smartphones, obtaining Root rights requires unlocking the bootloader (Bootloader), which is officially authorized by the company, but entails a complete cleanup of the device. Without this procedure, section /data/ It is not available even for advanced file managers.
An alternative and safer method is to use USB debugging and the Android Debug Bridge (ADB) tool, which does not require unlocking the bootloader, but necessitates enabling the developer mode. Through ADB, you can make a full backup of the Messages application, which will include both the database and settings.
To perform backup through the computer, you must execute the following command in the terminal:
adb backup -f sms_backup.ab -noapk com.android.providers.telephonyFile received sms_backup.ab It will contain an encrypted copy of the database, and it will require conversion to SQLite or retrieval through specialized utilities on a PC to continue to use it, and it is the only legal way to access system files without breaching the warranty and loss of data.
- π± Root access gives you full control over the file system, but cancels the warranty and reduces the security of banking applications.
- π» ADB Backup allows you to save data without superuser rights, but requires a computer and basic command line knowledge.
- βοΈ Cloud synchronization Mi Cloud is a standard method that does not require technical skills, but depends on the amount of free space in the cloud.
Local backup with MIUI and HyperOS
Owners of Xiaomi and Redmi smartphones do not need to resort to complex technical manipulations, since the system provides a powerful built-in archiving tool. It allows you to create complete copies of data, including SMS, on an internal drive or on a computer. SD-This is ideal for anyone who is planning to flash or buy a new device in the ecosystem. MIUI.
To create a local copy, you need to go to the settings menu and select About phone, then tap several times on MIUI or HyperOS to activate additional functions, or immediately find the Advanced Settings section. The Recovery and Reset menu selects the Local Backup option. Here you can tick the SMS option and start the process.
The created archive is saved along the path /MIUI/backup/AllBackup/. Inside the folder will be a file with a date and time of creation, containing compressed data from the message database, the advantage of this method is that recovery is very fast and does not require an Internet connection, unlike cloud services.
βοΈ Checking before creating a backup
It's worth noting that local backups don't automatically sync to the cloud, and if you lose your phone or damage it physically, the internal memory data will be lost along with the device, so it's critical to periodically migrate the archives you've created to your computer or external hard drive.
Sync with Mi Cloud and Google Account
The most modern and reliable way to store your message history is cloud sync, which is the responsibility of Mi Cloud on Xiaomi devices, and when synced, each new message is almost instantly copied to the companyβs servers, which allows you to recover correspondence even if your phone was lost or stolen simply by logging into your account on another device.
To activate the function, go to Settings -> Mi Account -> Xiaomi Cloud. In the list of data to sync, you should find Messages and activate the switch. The system will suggest combining local data with cloud data if they differ. A similar mechanism works through Google One, which also knows how to save SMS, although on Xiaomi devices, priority is often given to the native cloud.
| Parameter | Mi Cloud | Google Drive | Local backup |
|---|---|---|---|
| Automation | Complete. | Complete. | Only manually. |
| Network dependency | Wi-Fi/4G is required | Wi-Fi/4G is required | Not required |
| Limit the seat | 5GB (free) | 15GB (free) | Depends on the phone's memory. |
| Recovery | When logging in to your account | When setting up Android | Through the phone menu |
An important nuance is that synchronization of Mi Cloud only works with the standard Messages app. If you use third-party clients such as Textra or Google Messages (in some configurations), they may have their own, independent redundancy mechanisms not associated with Xiaomi system storage.
π‘
To save traffic, configure synchronization of Mi Cloud only through Wi-Fi. This will prevent the consumption of mobile Internet with a large amount of accumulated correspondence.
Analysis of the database structure of mmssms.db
For technicians and enthusiasts who have access to the mmsms.db file, the database is a standard SQLite file, consisting of several tables, the main ones being sms (for normal messages) and mms (for multimedia messages).
In the sms table, each entry contains the following fields: id (unique number), thread_id (dialog identifier, address, date, type, and body, the date is stored in milliseconds past the time stamp in Unix format. 1 January 00:00:00 UTC 1970 a year, which requires conversion for human perception.
Multimedia messages are more complex to store. Text and media files are spread out across different tables. Image and audio files are usually in a separate directory /data/data/com.android.providers.telephony/files/, and the database only contains links to them. When you transfer the database to another device without accompanying media files, MMS messages can be displayed incorrectly or empty.
- π The read field indicates whether the message was read by the user (1 - yes, 0 - no).
- π© The status field reflects the delivery status for outgoing messages (sent, delivered, error).
- ποΈ Deleted messages do not disappear instantly from the file, marked as free space, but standard means do not see them.
Recovering Messages from System Files
Recovery from a mmssms.db file directly to your phone without using a backup is extremely complex and risky. Simple file replacement in the system folder often fails due to the integrity and access rights of running Android services. The most effective method is using specialized software on a PC that can inject data from the SQLite database into the phone through the debugging interface.
However, if you have a local backup created by MIUI, it takes seconds to recover, and you just go to the backup menu, select the date you want to go and press "Restore," and the system unpacks the archive and integrates the messages into the database, following all the necessary file lock procedures.
β οΈ Note: When recovering from the cloud or local backup, messages with the same date and number can be duplicated if the sync was interrupted.
There are also third-party applications, such as SMS Backup & Restore, which create their own backup files (often in format) XML). If you used such programs, then you need to search for their files in the folder. /SMSBackupRestore/ on internal drive or Google Drive, not the system base of mmssms.db.
π‘
The most reliable way to ensure the safety of SMS is a combination of cloud synchronization Mi Cloud and periodic creation of local copies on the computer.