Fastboot Commands List: Safe, Caution and Risky Commands Explained

Xiaomi phone in Fastboot mode, illustrating a fastboot commands list

This fastboot commands list splits the commands you will meet in unlock, ROM and unbrick guides into three groups: ones that only read information, ones that change the phone but can be undone, and ones that can wipe data or leave the phone unbootable. Most bricks we fix start with a command copied from a guide for a different model, so knowing which group a command belongs to is the cheapest protection you have.

Everything below uses Google’s platform-tools build of fastboot (the help text quoted here is from version 34.0.3). If fastboot is not set up yet, follow our ADB and Fastboot setup guide for Windows 11 first, then come back.

Before you type anything

  • Know which mode you are in. The bootloader Fastboot screen and fastbootd (Fastboot in userspace) accept different commands. A quick check is shown in the read-only section below.
  • Know your exact model and region. A China unit and a global unit can share a name and still need different files. Our guide on China ROM vs Global ROM shows how to check.
  • Charge above 50% and use a data cable straight into the PC. A flash that stops halfway is a common way to end up in EDL or BROM mode.
  • Back up. Several commands on this page erase user data with no undo.

Safe commands: read-only checks

These commands only ask the phone for information or restart it. Running them does not change partitions or data.

Command What it does
fastboot devices Lists phones connected in Fastboot mode. If nothing shows, the problem is the driver or cable, not the phone.
fastboot getvar product Shows the product (codename) the bootloader reports. Compare it with the firmware you plan to flash.
fastboot getvar unlocked On many bootloaders, returns yes or no for the unlock state.
fastboot getvar current-slot On A/B phones, shows whether slot a or b is active.
fastboot getvar is-userspace Returns yes in fastbootd and no in the bootloader. This is how you tell the two modes apart.
fastboot getvar all Prints every variable the bootloader exposes. Not every bootloader supports it, and some print a lot.
fastboot flashing get_unlock_ability Returns 1 if unlocking is allowed (OEM unlocking is on in Developer options) and 0 if not.
fastboot reboot / fastboot reboot bootloader Restarts into Android or back into the bootloader.

On Xiaomi phones you can confirm the unlock state from Settings as well. Our guide to checking Xiaomi bootloader status covers both methods.

About oem commands: fastboot oem ... runs a command defined by the phone maker, so the list is different on every brand. Some phones answer fastboot oem device-info with their lock state, and others reject it. Never run an oem command copied from a guide written for another brand. The same word can mean something very different on another bootloader.

Caution commands: they change the phone but can be undone

Command What it does Main risk
fastboot boot boot.img Loads a boot image from RAM and starts it once, without writing it to the phone. Low. Usually needs an unlocked bootloader, and some phones do not support it. The next restart goes back to the installed image.
fastboot flash boot boot.img Writes the file to the boot partition. A boot image from another build or model causes a bootloop. Keep the stock boot.img for your exact build so you can flash it back.
fastboot set_active a (or b) Changes which slot the phone starts from on A/B devices. The other slot may hold an older or incomplete system, which leads to a bootloop. Switching back usually fixes it.
fastboot reboot fastboot Restarts into fastbootd. None by itself. It is needed for some partitions, as explained below.

The rule for this group: only flash files extracted from the official firmware for your exact model, region and build. If you are unsure whether a ROM package fits your phone, our page on the “This HyperOS version can’t be installed” error explains how Xiaomi checks this, and why forcing a mismatched package is a bad idea.

Risky commands: data loss or a phone that will not boot

These are the commands behind most “it was working until I ran one line” cases. Read the whole row before using any of them.

Command What it does Why it is risky
fastboot flashing unlock Unlocks the bootloader. The phone shows a warning and, once you accept it, performs a factory reset. Everything on the phone is erased. On Xiaomi phones unlocking goes through the official Mi Unlock process instead.
fastboot flashing lock Relocks the bootloader and resets the phone. If any partition is not 100% stock for that phone, the phone can refuse to boot after locking. On Xiaomi this often shows as “The system has been destroyed”.
fastboot flashing unlock_critical Unlocks the bootloader’s critical partitions. Needed only for firmware-level updates. It requires a button press on the phone, and a wrong file flashed afterwards can hard-brick the device.
fastboot -w Wipes user data. Photos, apps and accounts are gone. Many full-ROM flash scripts include it, so read the script before you run it.
fastboot erase <partition> / fastboot format <partition> Erases or formats a partition. Erasing a partition you cannot restore, such as one that holds calibration or radio data, can leave a phone that boots but has no signal or sensors.
fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img Turns off verified boot checks when flashing vbmeta. Used for some mods. With a mismatched vbmeta the phone bootloops, and on many phones a data wipe is needed after changing these flags.
fastboot wipe-super Resets the super partition to an empty layout. Removes system, vendor and product in one step. The phone will not boot until a full ROM is flashed.
fastboot snapshot-update cancel Cancels an in-progress snapshot (virtual A/B) update. The tool’s own help says this “may make the device unbootable until it is reflashed.”
fastboot delete-logical-partition / resize-logical-partition Changes the layout inside super (fastbootd only). A wrong name or size breaks the system partitions.
flash_all_lock scripts (Xiaomi “clean all and lock”) Flash a full ROM and then relock. Safe only with official stock firmware for that exact phone. With a converted or modified ROM, see our notes on HyperOS 3 bootloops on converted Global ROMs.

Xiaomi users should also check anti-rollback before flashing an older build. Our Xiaomi anti-rollback guide explains how to read the value first.

Bootloader Fastboot vs fastbootd: why some flashes fail

Since Android 10, phones that launched with dynamic partitions keep system, vendor and product as logical partitions inside one large super partition. According to the Android Open Source Project documentation on fastbootd, the bootloader is not supposed to flash or erase these logical partitions. That job moved to fastbootd, a Fastboot mode that runs in userspace.

In practice:

  • Flashing boot, vbmeta or dtbo usually works from the bootloader.
  • Flashing system, vendor or product from the bootloader often fails. Run fastboot reboot fastboot first, confirm with fastboot getvar is-userspace, then flash.
  • Official flash scripts switch between the two modes for you, which is one reason they are safer than typing partitions by hand.

The two modes can also behave differently after an update. After ColorOS 17, some China OnePlus owners reported that the bootloader Fastboot screen closes on its own while fastbootd still works. Details are in our ColorOS 17 Fastboot report.

Unlocking rules every Android phone follows

The AOSP locking and unlocking rules explain why the same commands behave alike across brands:

  • flashing unlock is refused unless get_unlock_ability is 1, which happens when you enable OEM unlocking.
  • Unlocking always ends with a factory reset, so data cannot be read from a stolen phone.
  • Unlocking the critical partitions needs a physical button press and cannot be done from the PC alone.

Brands then add their own layer: Mi Unlock wait times on Xiaomi, and Deep Testing approval on China ColorOS. Before you unlock, read is unlocking the bootloader safe for what changes with banking apps, OTA updates and Play Integrity.

If a command already went wrong

  • Bootloop after flashing boot or vbmeta: flash the stock image for your exact build back from Fastboot.
  • Stuck on the Fastboot screen after a wipe or a failed script: the phone usually still accepts commands, so a full official ROM flash can recover it.
  • Black screen, not detected as Fastboot, shows as Qualcomm 9008 or MediaTek port: this is a deeper brick. Our guide to soft brick vs hard brick helps you identify the mode before you try anything else.

If you would rather not risk it, we fix these cases remotely. See Xiaomi unbrick services and OnePlus unbrick services, or Xiaomi, Redmi and POCO bootloader unlock if you have not unlocked yet.

FAQ

Which fastboot commands are completely safe?

fastboot devices, the getvar commands, flashing get_unlock_ability and the reboot commands only read information or restart the phone. They do not write to any partition.

Does fastboot flash erase my data?

Flashing a single partition such as boot does not wipe user data by itself. Unlocking the bootloader, fastboot -w, and many full-ROM scripts do erase it, so check the script first.

Why does fastboot say a partition cannot be flashed?

On phones with dynamic partitions, system, vendor and product live inside super and must be flashed from fastbootd. Run fastboot reboot fastboot and try again. A locked bootloader also blocks flashing.

Is fastboot boot safer than fastboot flash?

Yes. fastboot boot runs the image once from RAM and the next restart returns to the installed one. Not every phone allows it, and it usually needs an unlocked bootloader.

Can relocking the bootloader brick my phone?

It can if anything on the phone is not the official stock software for that model. Return to full stock first, check that it boots, and only then relock.

Not sure which command your phone needs, or a flash already went wrong? Contact us with your model, region and what is on the screen, and we will tell you the safest next step.

Featured photo: Fastboot.jpg by Foyejbd, CC BY-SA 4.0, via Wikimedia Commons (cropped, title and callout added).

Comments

0 comments

Join the discussion