Fastboot Commands Reference
Fastboot is a diagnostic and engineering protocol that lets you communicate directly with the device bootloader over USB. It is used to flash custom recoveries, kernels, partitions, and unlock bootloader security.
Need device-specific OEM unlock guides or Project Treble GSI flashing tutorials?
fastboot devicesScans USB buses and lists all Android hardware currently running in low-level bootloader / fastboot protocol mode.
fastboot getvar allDumps the entire set of hardware and bootloader environment variables exposed by the device firmware.
fastboot getvar unlockedQueries whether the bootloader is currently locked ("no") or unlocked ("yes"). Unlocking is mandatory before flashing partitions.
fastboot getvar current-slotReturns which partition slot (either "a" or "b") the device is currently configured to boot from on A/B dual-slot devices.
fastboot oem device-infoDisplays OEM manufacturer-specific security data, including tamper status, critical unlock flag, and charger screen status.
fastboot rebootRestarts the device normal operating system, exiting the bootloader environment.
fastboot reboot-bootloaderReboots the hardware and immediately re-enters the bootloader/fastboot interface. Useful for reloading partition tables after flashing.
fastboot reboot fastbootSwitches the device into FastbootD mode, which runs within recovery ramdisk to facilitate resizing and flashing logical dynamic partitions.
fastboot reboot recoveryReboots the device from Fastboot mode straight into recovery mode (TWRP, OrangeFox, or stock recovery).
fastboot continueInstructs the bootloader to continue loading the OS kernel without performing a full hardware power cycle.
fastboot flashing unlockInitiates standard bootloader unlocking on modern Android devices (Android 6.0+). Prompts on-screen confirmation and factory resets all user data.
fastboot flashing lockRe-locks the bootloader and re-enables Android Verified Boot (AVB). Requires 100% stock firmware; factory resets the device.
fastboot flashing unlock_criticalUnlocks deeper, critical bootloader and low-level firmware partitions (e.g. bootloader, radio, abl) on devices requiring extra authorization.
fastboot oem unlockLegacy command used to unlock bootloaders on older Android devices (Android 5.1 and earlier, or specific OEM implementations).
fastboot boot <boot_image.img>Loads and boots a kernel or recovery image (like TWRP or patched boot.img) directly into RAM without flashing or overwriting the device flash storage.
fastboot flash boot <boot.img>Writes a kernel boot image to the boot partition. Commonly used for rooting with Magisk or installing custom kernels.
fastboot flash init_boot <init_boot.img>Flashes the dedicated init_boot partition introduced in Android 13+ devices (e.g. Pixel 7/8/9, Galaxy S23/S24) for Magisk / KernelSU root.
fastboot flash recovery <recovery.img>Installs a custom recovery (such as TWRP or OrangeFox) onto the dedicated recovery partition (on legacy or non-A/B devices).
fastboot flash vbmeta --disable-verity --disable-verification vbmeta.imgFlashes the Verified Boot Metadata partition while explicitly patching security flags to allow booting custom or modified system partitions.
fastboot flash system <system.img>Writes a complete Android operating system system image or Generic System Image (GSI) to the system partition.
fastboot flashall -wFlashes all firmware images (bootloader, radio, boot, system, vendor, product) contained in the current directory matching Android factory specs.
fastboot erase userdataPerforms a hardware-level raw sector wipe of the userdata partition, removing all user accounts, installed apps, photos, and settings.
fastboot -wStandard Fastboot shortcut to erase both the userdata partition and cache partition simultaneously before installing a clean ROM.
fastboot erase systemWipes the system partition clean prior to flashing a fresh operating system image.
fastboot set_active <a|b|other>Changes the active bootable slot on dual-slot A/B partition architectures. Critical for recovering from a bad update on the other slot.
fastboot format:ext4 userdataFormats and creates a fresh filesystem (ext4 or f2fs) on the userdata partition. Essential when removing encryption or switching filesystem types.
fastboot flash --slot=all boot boot.imgFlashes the specified image to both slot _a and slot _b in one command, ensuring slot parity.
fastboot stage <file>Uploads raw binary data to the bootloader buffer without writing it directly to a flash storage partition.