How can we backup our android stock rom using terminal?? Not asking about backing up the data(messages, pics, etc) but the OS. so that if something goes wrong while flashing a custom rom i can roll back to my stock rom.

  • if you're not on system-as-root (Pie) then just adb pull /system – alecxs Aug 15 at 9:04
  • 1
    @alecxs that will copy files/directories but won't preserve file permissions and other attributes, so restore won't work. Instead dumping complete images of system, boot and vendor (if exists) partitions is more secure way. Or at least create tar archives. – Irfan Latif Aug 15 at 9:14
  • @IrfanLatif true. but adb works without root (and has -a flag for permissions) - anyway, i wouldn't do this. why not just download from www :) – alecxs Aug 15 at 9:17
  • 1
    @alecxs -a preserves file timestamps and mode, not extended attributes like SELinux contexts. Will also break dm-verity. Without root options are limited. – Irfan Latif Aug 15 at 9:23
  • 1
    What you are looking for has already been asked and answered many times in one way or another. Try here: android.stackexchange.com/search?q=Backup+image – Firelord Aug 15 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.