Forgot a pattern lock on Xiaomi: how to unlock your phone without resetting data

The forgotten pattern lock on Xiaomi’s smartphone is a situation that thousands of users face every day. The main problem is that most standard unlock methods (such as Mi Account) require a factory reset, resulting in complete loss of data β€” photos, messages and applications. However, there are ways to get around locking without formatting memory if you act carefully and use hidden firmware functions.

In this article, we will discuss 5 working methods of unlocking Xiaomi (including the Redmi Note 10/11/12, POCO X3/X4, Mi 11/12 and others) with data storage. Importantly, the effectiveness of each method depends on the version of MIUI, the status of the bootloader and the availability of backups. Some methods require a PC, others work directly on the phone – choose the appropriate option.

Why Standard Methods Don't Work Without Data Loss

Most guides on the Internet offer to reset your phone via Recovery Mode or Find Device, but these methods have critical drawbacks:

  • πŸ”„ Reset via Recovery: Deletes all data in the section /data, including internal memory.
  • 🌐 Find Device (i.mi.com): Requires a tied Mi Account and active internet, but even then resets settings.
  • πŸ”§ Fastboot: Commands like fastboot erase userdata erase user data.

The reason is MIUI architecture: the pattern lock is stored in the encrypted /data/system/gesture.key partition, which is associated with the user profile. Standard methods simply delete this partition, not bypass the lock.

⚠️ Note: If the phone has data encryption enabled (in the security settings), the chances of saving files without a backup are near zero. β†’ Additionally. β†’ Encryption and accounts.

Method 1: Unlock via ADB (if USB debugging is enabled)

The most reliable way to avoid data loss is to use ADB (Android Debug Bridge), but it only works if USB debugging has been activated in Settings β†’ About Phone β†’ MIUI version (7 times press to unlock the developer mode).

If debugging is enabled, follow the instructions:

  1. Connect your phone to your PC via USB.
  2. Open the command prompt (cmd on Windows or Terminal on macOS/Linux).
  3. Enter the commands in order adb shell su rm /data/system/gesture.key reboot

After the restart, the phone will prompt you to enter a new pattern lock. If the su command is not working (no root rights), try an alternative option:

adb shell am start -n com.android.settings/.ChooseLockGeneric

Make sure the debugging is done USB included|Install ADB-PC drivers|Connect your phone to the original cable|Check the visibility of the device by the team `adb devices`-->

⚠️ Attention: On new versions MIUI 14+ This method may not work because of the increased protection, so if you get the phone hanging on the logo after the command, move on to the next method.

Method 2: Use Safe Mode (if the key is recently installed)

If the pattern lock was installed less than 24 hours ago, you can try bypassing it through Safe Mode.This mode temporarily disables third-party apps, including screen locking from Xiaomi.

Instructions:

  1. Press the power button until the shutdown menu appears.
  2. Press and hold the β€œStop” option (or β€œStop Power”) before a request to switch to Safe Mode appears.
  3. Confirm the transition. After downloading, delete or reconfigure the pattern lock to Settings β†’ Lock screen.

If the Safe Mode option doesn’t appear, try an alternative method:

  • πŸ”‹ Turn off the phone.
  • πŸ”˜ Press the power button. + volume down until the Mi logo appears.
  • πŸ“± Release the buttons and immediately press the volume down, holding until full load (the watermark "Safe Mode" should appear at the bottom of the screen).

πŸ’‘

If the lock is still in Safe Mode, try installing a new pattern lock over the old one – sometimes the system allows you to do this without resetting.

Method 3: Unblock with Mi Account (if an account is linked)

Xiaomi’s official way of unlocking is through Mi Account, but it only works if you meet three conditions:

  • πŸ“± Phone linked to Mi Account (checked at account.xiaomi.com).
  • 🌐 Internet access (via Wi-Fi or mobile network).
  • πŸ”’ No encryption is enabled on the phone (see warning above).

Steps:

  1. On the locked screen, click "Forgot Password?" (or "Forgot Pattern").
  2. Select "Login through Mi Account" and log in.
  3. Follow the instructions for resetting the pattern lock.
Xiaomi modelSupport for unlocking through Mi AccountData retention
Redmi Note 10/11Yes.Partially (photos and files will be saved, but settings will reset)
POCO X3/X4Yes.Yes (unless there is encryption)
Mi 11/12Yes, but requires SMS confirmation.No (reset to factory)
Redmi 9A/9CYes.Yes.

⚠️ Attention: On models with MIUI 13+ After unlocking through Mi Account, you may need to confirm SMS, which will come to the number linked to the account. SIM-The card is inactive – the method will not work.

Redmi Note 10/11/12|POCO X3/X4/X5|Mi 11/12/13|Redmi 9/9A/9C|Another model-->

Method 4: Bypassing locking via TWRP (for hardened phones)

If your Xiaomi has a custom TWRP recavator installed, the chances of unlocking without losing data increase, a method that is suitable for users who have previously unlocked the bootloader and installed unofficial firmware.

Instructions:

  1. Turn off the phone.
  2. Press the power button + volume up to enter TWRP.
  3. Go to Advanced β†’ File Manager.
  4. Delete files: /data/system/gesture.key /data/system/locksettings.db /data/system/locksettings.db-wal /data/system/locksettings.db-shm
  5. Reboot the phone.

If the phone requests after deleting the files PIN-code SIM-It's not blocking the screen, so it worked. If it's not, try the extra step:

What if TWRP doesn’t see the /data folder?
If the /data partition is encrypted, you need to decrypt it first. To do this, select Mount β†’ Data in TWRP and enter a password (if you have set one), If the password is unknown, unlocking without loss of data is impossible.

Warning: On some models (Mi 10T, POCO F3), anti-rollback may be triggered after locksettings.db manipulation, leading to a device breakage. Before you act, check your model’s compatibility on the 4PDA or XDA Developers forums.

Method 5: Unlocking through service codes (hidden menus)

A little-known way is to use service codes to reset locks, which doesn't work on all models, but can help if other methods aren't available.

Try the following combinations:

  • πŸ“ž Dial on the dial keyboard: ##7780## (soft reset, saves data).
  • πŸ”’ To reset the pattern lock: ##3646633## (Engineering Mode, then go to Security β†’ Lock Screen β†’ Clear Password).
  • πŸ”’ Alternate code: ##1998## (powered by some Redmis).

If you enter a Chinese menu, use Google Translate with a camera-based text recognition feature, and look for items with the words lock, password, or gesture.

πŸ’‘

Service codes are the riskiest method. Wrong actions can result in an IMEI reset or network loss. Use only if you are sure of compatibility with your model.

What to do if nothing helps: extreme measures

If all of these methods fail, there are two options:

  1. Contact the Xiaomi service center with proof of purchase (check). Official centers can unlock the phone without losing data, but this is a paid service (from 1000 to 3000 rubles).

Before visiting the service center:

  • πŸ“„ Prepare documents for the phone (box, check, warranty card).
  • πŸ”Œ Make sure your phone is at least 50% charged – some centers are refusing to service discharged devices.
  • πŸ” Check if your model is guaranteed (unlocking it may invalidate it).

If you decide to reset your phone via Fastboot, try extracting data through the first DD-Skills (will require skills to work with) ADB Instructions are available on 4PDA in your model themes.

FAQ: Frequent questions about unlocking Xiaomi

Can you unlock Xiaomi without losing data if USB debugging has been disabled?
Theoretically, yes, but only through Mi Account (if the phone is tied) or Safe Mode (if the key is recently installed). In practice, the odds are minimal - without ADB or TWRP, it is almost impossible to bypass the lock. If data is critical, contact the service center.
Why does the phone still ask for a pattern lock after resetting via Mi Account?
This is due to the residual lock files in the section. /data. Solution: Log in to Mi Account again. Install PIN-Reset the phone and change the phone. PIN If it doesn't work, you need a complete reset.
Does Google Find My Device work on Xiaomi?
Google’s Find My Device does not support screen unlocking on Xiaomi due to MIUI limitations.This method only works on β€œpure” Android (like Pixel or Samsung).
How to avoid data loss in the future?
Four rules: πŸ” Put the debugging on. USB Save a backup copy through adb backup. πŸ“€ Regularly copy photos to Google Photos or Mi Cloud. πŸ“ Write down the pattern lock to the password manager (e.g. Bitwarden or KeePass). πŸ”„ Set up automatic export SMS in Google Drive (Messages app) β†’ Settings β†’ Backup).
Can I unlock Xiaomi with a computer without ADB?
Yes, but only through specialized programs like Miracle Box or UFi Box, these tools are paid (from 500 rubles for a one-time license) and require skills to work with Fastboot: 🚨 Possibility of a phone blink (breakdown) when used incorrectly. πŸ” Programs may contain malicious code (download only from trusted sources). For beginners, it is better to choose other methods.