46

Many people say that fastboot can be used to flash an image on one of the partitions.

Is the reverse also possible, that is to take a binary snapshot and store it as a zip file containing the exact binary representation of the partition to be backed up?

The reason I ask this is backup has two steps.

  1. Take an image/snapshot and store it in the backup location (backup), and
  2. Replacing the image/snapshot with the one from the backup location (restore)

To me, it seems that fastboot is only doing (1), while being able to write to the Android's internal flash (in binary "dd"-style) seems it should also be able to read from the flash.

This way, nobody would need to organize and run another potentially not trustworthy ROM to do the reading job.

3
  • Not possible with fastboot. However, adb has a TWRP backup mode :)
    – Tom Hale
    Commented May 17, 2022 at 9:18
  • I'm still low rep on this SE, so posting as a comment: New versions of fastboot have a fetch PARTITION OUT_FILE command, this was added in recent versions of Android along with the fastbootd machinery
    – tux3
    Commented Oct 27, 2022 at 11:14
  • @tux3 The question has been unprotected. Feel free to post an answer :)
    – Andrew T.
    Commented Mar 20, 2023 at 3:33

2 Answers 2

31

If you check with our tag-wiki, and follow up the link to the List of fastboot commands, you will see the answer is NO. Fastboot only has commands to write to the device. A few exceptions include:

  • making sure there is a device at all, using fastboot devices
  • some OEM specific commands to read configuration values (fastboot oem <option> – note that all those, except for oem lock/oem unlock, options start with INFO?)
  • several bootloader specific commands
  • rebooting the device after "work done" (fastboot reboot / fastboot reboot-bootloader)

From the CyanogenMod Fastboot Intro, emphasis mine:

fastboot is a small tool that comes with the Android SDK (software developer kit) that can be used to re-flash partitions on your device. It is an alternative to the recovery mode for doing installations and updates.

Wikipedia describes fastboot as a diagnostic protocol included with the SDK package used primarily to modify the flash filesystem via a USB connection from host computer. (again, emphasis mine).

No source speaks about backing up partitions (or data) from the device.

Update: newer SDKs added fastboot fetch PARTITION OUT_FILE, so backing up partitions should be possible. However, I didn't yet encounter a device supporting that – plus you'd need to know the names of partitions in advance (I didn't see any fastboot command to list existing partitions).

6
  • 6
    Thank you, for answering the question. I know that it must seem to you, that I simply was not looking well enough for the info myself. With uboot, recovery partition, recovery mod, clockworkmod, fastboot, adb, etc there are really lots of things that seem to have similar purposes and the info is sometimes confusing. the point in real is that writing and reading to/from memory are basic operations and it seemed idiotic that one makes fastboot only being able to do one of the both. It is great you can flash with fastboot, but why would it not be able to read seemed "wrong to me", so i asked Commented Feb 23, 2016 at 16:50
  • I didn't blame you in any way: Especially people new to it can easily get confused here (for the reasons you've pointed out). Had I wanted to blame you, I'd placed an "RTFM comment" – instead I rather thought a little summary cannot hurt .) // In fact, backing up partitions can be much more tricky (unless your custom recovery's Nandroid does exactly that). You can dd and transfer partitions, my Adebar can help you create a fitting script for that (working via ADB).
    – Izzy
    Commented Feb 23, 2016 at 16:56
  • of course, I simply though you were in the right hinting on the available resources. your answer was great and nicely phrased, thank you! I missed stating some background when composing the message. The background (i added in the meanwhile) is simply -and as indicated on the tag wiki- that its absurd (to me) you can flash images but not take them. Commented Feb 23, 2016 at 17:00
  • That's not that absurd. It'd be absurd if you could create a backup that way but had no way to restore it #D But yes, I get your point of course. Glad I was able to shed some light!
    – Izzy
    Commented Feb 23, 2016 at 17:03
  • I suspect there is also the issue of security. One could use fastboot to make a sector image of a locked device, allowing access to the filesystem content without needing to factory reset.
    – jiggunjer
    Commented Jul 13, 2017 at 12:00
24

We can temporarily load a custom recovery

fastboot boot <kernel> [<ramdisk>]

then backup system partitions.

2
  • 3
    For future readers: the device must support the fastboot boot command. <kernel> may be something like ClockworkMod (cwm.zip) or TWRP (twrp*.img).
    – Johann
    Commented Sep 24, 2018 at 22:33
  • 4
    On some phones (e.g. Xiaomi) this also requires that the bootloader is unlocked, which you can't do without a data wipe.
    – chrki
    Commented Sep 25, 2018 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .