Backup and Restore with adb - Google Pixel 4a 5G Guides, News, & Discussion

Since we do not have TWRP, our options for backing up and restoring our data is limited. I use Titanium Backup Pro, but recently ran into issues with libmtp when trying to copy the ttbu folder from my sdcard to my computer. So I decided to use adb backup and restore instead. It worked very well, so I decided to write some scripts to make it easier. Now I will share them here.
These scripts were written in Linux and meant to be used in Linux. If you are versed in scipts for windows (.bat), please feel free to use my scripts as a guideline.
You can clone the repo here
android_backup_restore​
Before doing anything, I strongly suggested reading the README.md first.
The scripts are a little rough right now, as they are a WIP. But they work just fine.

Hi ! Thanks for the thread. It's possible toi use it on OsX ? I do to convert script for run on terminal ? Or just use shell ? I'm not an expert. Thanks

Related

TaBackup & EasyKernel Backup and Restore

Since we have a lot of users here with no real means of doing automated proper backups of their tabs outside of ClockworkMod, or manual backups using RotoBackup, I've decided to release my implementation of a backup routine to XDA.
It's based upon RotoBackup and thus requires full SU access on your Tab.
It also requires Heimdall and ADB to be working if you wish to restore a backup fully.
The routine currently only supports RFS filesystems, EXT4 support may be added later!
I have tested this as much as I can, and I do hope that it works for everyone who tries it.
It is windows only, however if someone wishes to redo the script as a shell script feel free!
--
Down to the attachments.
TaBackup.zip
- TaBackup.cmd : Full tab backup and restore script
- KernelBackup.cmd : Kernel backup and restore script
GTab-Heimdall_1.1.1.7z
- WORKING Heimdall 1.1.1 which is required if you wish to RESTORE
- WORKING USB drivers for DOWNLOAD MODE, required for Heimdall
Both freely available from https://github.com/Benjamin-Dobell/Heimdall
Extract the zip to a directory, preferred directories are;
C:\GalaxyTab\Backups for TaBackup.cmd
C:\GalaxyTab\KernelBackup for KernelBackup.cmd
You _can_ change these defaults by editing the script and changing line 8
You need ADB WORKING, either from the same directory as TaBackup, or from your system PATH
Due to the hasty modification of TaBackup last night to create KernelBackup, there is legacy code floating around which requires heimdall.exe to be present in the same directory as the backups... I may change this at a later date.
It IS possible to have both backup locations the same, e.g. C:\TaBackup
with both scripts in that directory, with Heimdall. You just have to remember which backup directory is just a kernel backup only.
--
Good luck, and happy hunting!
--
Changelogs:
TaBackup 0.5
First public release
Various logic fixes
Idiotic spelling mistake which prevented a restore!
KernelBackup 0.1
First public release
Reserved for Future Use
Perfect - will try!
Sent from my GT-P1000 using Tapatalk
Thanks! This saved me from creating a script myself. I am anal about backups so this is perfect. So far I have only tested the standard backup (it's running as I type this and then will test the Kernel as well. One thing to note, the script requires that you adb installed / path defined in your system variables. Originally it would not work for me as I continued to get unknown command. I have successfully used adb commands to execute the backup before, but only executed it straight from the directory where I had adb installed. Once I added the path to adb in my system variables then it worked great.
Ah yes, ADB pathing :|
I may try and do some rudimentary checks in the scripts for ADB
You said ext4 not supported, does this mean that if right now I back up while using rfs and I convert to ext4 I will not be able to restore my backup that was made on rfs? Or only that it won't backup and restore ext4
Sent from my SPH-P100 using XDA App

[Q] How to make a nandroid backup on OSX

Hello,
I'd like to know if it is possible to make a nandroid backup of my galaxy nexus directly on OSX because I don't have enough free memory available at the time on my phone.
Cheers
You could use adb backup and adb restore to achieve similar things as a nandroid. Searching around should allow you to find some documentation on how to use it.
I'll try that then.
thanks

[Q] [How to] Save the just data from specific apps

Hello guys!
I want to format everything and give a fresh start on my GNexus. I am finding it very laggy and I think that the problem is on using the same app backup for almost an year. I make the full backup in the recovery and after wiping everything and installing a new rom, I restore everything. I believe that there are many apps in my phone that I don't use anymore and are there as trash that needs to be cleaned...
I know about Titanium Backup, but I'm on ART and I never learned how to use the damn program correctly, so there is much complication to just backup some apps. What I really need is a method for backing up JUST the data (ex: the savedata from the games) and not the apk. So that I can wipe everything in the phone (all the partitions), install the rom and fixes and everything and then intall via google play the apps again and put the backed data in its place again.
I don't know if I made myself clear, maybe I'm just complicating, but if you play or played roms on an emulator, you have the rom and its save. I want to backup the save file, delete the rom and the emulator itself. Then install the emulator again (clean install), donwload the roms (clean ones) and put the old save in the place. :good:
Well, thanks in advance :laugh:
Rayaxe said:
I know about Titanium Backup, but I'm on ART and I never learned how to use the damn program correctly,
Click to expand...
Click to collapse
Titanium works on ART now, as is my understanding. It's not complicated to learn. Just select the app and hit backup, and Bingo Bango, you're done.
Then when you restore, you can select just data.
Piece of cake, ace.
yeah, I finnaly made it, my problem was ART, I didn't notice they updated the app ehehe
thanks
Yeah I personally don't recommend tibu. I've tried it myself and had issues related to Android version at the time and I just see this over and over. The other thing is that there are excellent options available without an app. My favorites for backing up just /data/data/<app_data_dir> are:
Code:
#> cp -a /data/data <backup_location>
OR you can use
Code:
#> adb backup -noapk -all
Type adb in terminal on phone or on computer to see more info for this one, that's basically it though. You can use adb to backup directly onto your phone or computer, very useful when you need some space!!
The most important thing though when you're backing up data is to preserve permissions and be able to set new ones for data if the apk owner "id" changes, e.g. app re-installations. Otherwise you'll run into some pretty bad problems.. not so fun. So definitely use a tar archive for file permissions preservation and some fast lzma lzop compression on top of the tar archive. 'busybox tar' usually has all of these options. A lot of roms' busybox and functions get stubbed and made useless, so I would check out Terminal IDE if you want to go this route. 'Definitely want the full gnu options and consistency. Vanir by itself is also good here, and I use it 24/7 for this reason. It really does have a hemi, they're not kidding.
7175 said:
Yeah I personally don't recommend tibu. I've tried it myself and had issues related to Android version at the time and I just see this over and over. The other thing is that there are excellent options available without an app. My favorites for backing up just /data/data/<app_data_dir> are:
Code:
#> cp -a /data/data <backup_location>
OR you can use
Code:
#> adb backup -noapk -all
Type adb in terminal on phone or on computer to see more info for this one, that's basically it though. You can use adb to backup directly onto your phone or computer, very useful when you need some space!!
The most important thing though when you're backing up data is to preserve permissions and be able to set new ones for data if the apk owner "id" changes, e.g. app re-installations. Otherwise you'll run into some pretty bad problems.. not so fun. So definitely use a tar archive for file permissions preservation and some fast lzma lzop compression on top of the tar archive. 'busybox tar' usually has all of these options. A lot of roms' busybox and functions get stubbed and made useless, so I would check out Terminal IDE if you want to go this route. 'Definitely want the full gnu options and consistency. Vanir by itself is also good here, and I use it 24/7 for this reason. It really does have a hemi, they're not kidding.
Click to expand...
Click to collapse
looking for this method, very nice!
thanks, next time I need to backup I will use this xd

[Q] adb backup

So I'm looking to do some playing around with my G3, it's a Sprint Variant, has been stump rooted; nothing else. I run Ubuntu 14.04 LTS, have installed adb/fastboot, and it sees the device as being connected.
I can't shell / dd the twrp file as it mentions being able to do manually in the thread from my PC (under terminal); denies me permission, despite the file being in the main directory of the Internal storage (or does it need to be in the physical 'root' directory? This wasn't clear for me on the Bump! TWRP Thread).
I did however pass the hiddenmenu tag for disabling ota updates directly through terminal emulator on the device itself, so I do have access to be able to do it that way.
Long and short, can I make a back up of everything as it is now on the device (firmware, radio, baseband and all associated files)? Without having to get them here on xda?
I will read instructions; I've gotten this far by reading, I just can't find the information I'm looking for.
Thanks in advance, hopefully I can get some solid instructions.
If you have the proper twrp image for your phone loaded at the root of your internal SD, you can install it using the terminal emulator app right on your g3.
You just input the three command lines starting with the "su" line.
After you do that, you can launch into recovery (I like the Quick Boot app for that), then use twrp to do a backup. In my case I reformatted my external SD card to fat32, from twrp, so that card would be usable by both normal android and twrp (backup the external SD to your PC or a flash drive before reformatting, then copy the files back in after it is done)
There is one last chunk of stuff to backup. See http://forum.xda-developers.com/showthread.php?t=2907329
Good luck!
markfm said:
If you have the proper twrp image for your phone loaded at the root of your internal SD, you can install it using the terminal emulator app right on your g3.
You just input the three command lines starting with the "su" line.
After you do that, you can launch into recovery (I like the Quick Boot app for that), then use twrp to do a backup. In my case I reformatted my external SD card to fat32, from twrp, so that card would be usable by both normal android and twrp (backup the external SD to your PC or a flash drive before reformatting, then copy the files back in after it is done)
There is one last chunk of stuff to backup. See http://forum.xda-developers.com/showthread.php?t=2907329
Good luck!
Click to expand...
Click to collapse
I already dd'ed the EFS files in question through terminal emulator, and I'm sure I can install TWRP just fine through there as well.
To clear this up, I don't want to install TWRP right away. I want to back up my device's recovery files, baseband, radio, and all the vitals, and basically make a personal .tot or .kdz for it to restore to (that I don't have to source online) under, say, the flashtool.
Hopefully this helps clear this up and someone has the answers I'm really looking for.

Way to backup and restore from PC (no root)?

At the moment I dont' want to unlock,root the phone and install TWRP because I'm fine with stock Rom, but there's a way to backup to pc and restore from pc as we can with TWRP recovery?
Thanks
failax said:
At the moment I dont' want to unlock,root the phone and install TWRP because I'm fine with stock Rom, but there's a way to backup to pc and restore from pc as we can with TWRP recovery?
Thanks
Click to expand...
Click to collapse
ADB Backup
https://9to5google.com/2017/11/04/how-to-backup-restore-android-device-data-android-basics/
Google search link with 1.590.000 hits
My command line is:
Code:
adb backup -apk -shared -all -system -f C:/user/Pixel2XL/adb_backup/mmddyy.ab
This backs up all user apps and data, all system apps and data, and shared storage (internal SD card)
Pkt_Lnt said:
ADB Backup
https://9to5google.com/2017/11/04/how-to-backup-restore-android-device-data-android-basics/
Google search link with 1.590.000 hits
My command line is:
Code:
adb backup -apk -shared -all -system -f C:/user/Pixel2XL/adb_backup/mmddyy.ab
This backs up all user apps and data, all system apps and data, and shared storage (internal SD card)
Click to expand...
Click to collapse
Actually, you might want to include
Code:
-obb -keyvalue
*if you want to backup your games and any "apps that perform key/value backups"
What a great idea @Pkt_Lnt! I wish I realized this when I was planning to root and wanted to backup as best I could...
I'm purely just wondering, why include "-apk -shared" & "-system" when you have an option of "-all"? And isn't including "-f" meant to backup a specific file?
P.S. nevermind (on the -all & -system), after reading the help on the command, -all doesn't cover system apps...
Also, in terms of restoring.... would this method depend on root access for full restoration? does this method even backup settings and "personalizations" without root access (at least when backing up)?
simplepinoi177 said:
Actually, you might want to include
Code:
-obb -keyvalue
*if you want to backup your games and any "apps that perform key/value backups"
What a great idea @Pkt_Lnt! I wish I realized this when I was planning to root and wanted to backup as best I could...
I'm purely just wondering, why include "-apk -shared" & "-system" when you have an option of "-all"? And isn't including "-f" meant to backup a specific file?
P.S. nevermind (on the -all & -system), after reading the help on the command, -all doesn't cover system apps...
Also, in terms of restoring.... would this method depend on root access for full restoration? does this method even backup settings and "personalizations" without root access (at least when backing up)?
Click to expand...
Click to collapse
1 - I was trying to teach the poster above to fish, not trying to do the fishing for him. That said, I'm not a gamer, that "-obb" is not relevant to me.
2 - backup -f file Write an archive of the device's data to file.
This Reference
I do not see your "-keyvalue" in that ADB Command Reference doc, you might want to verify that before using it.
This is my actual command line from today. I'm on Linux, so I tried to make this easier for the Win crowd, knowing the tilde_backslash_path would throw 99% of those who might read this for a loop!
Code:
[email protected] ~ $ adb backup -apk -shared -all -system -f ~/Pixel2XL_adb_backup/backup05172018.ab
3 - ADB commands to not require root. Restore has always worked for me, and as you might guess, I have many "adb grant permissions" in use. :good:
For the rest of your questions, sorry I don't have time to do that research for you. All I use is the This Reference above, if that does not provide what you are asking, try this.
Pkt_Lnt said:
1 - I was trying to teach the poster above to fish, not trying to do the fishing for him. That said, I'm not a gamer, that "-obb" is not relevant to me.
2 - backup -f file Write an archive of the device's data to file.
This Reference
I do not see your "-keyvalue" in that ADB Command Reference doc, you might want to verify that before using it.
This is my actual command line from today. I'm on Linux, so I tried to make this easier for the Win crowd, knowing the tilde_backslash_path would throw 99% of those who might read this for a loop!
Code:
[email protected] ~ $ adb backup -apk -shared -all -system -f ~/Pixel2XL_adb_backup/backup05172018.ab
3 - ADB commands to not require root. Restore has always worked for me, and as you might guess, I have many "adb grant permissions" in use. :good:
For the rest of your questions, sorry I don't have time to do that research for you. All I use is the This Reference above, if that does not provide what you are asking, try this.
Click to expand...
Click to collapse
Cool...thanks for answering what you could...I was merely curious; I didn't mean/intend/imply that you do the research for me or anything. Yea, I know absolutely nothing about Linux and it's environment; so I/we appreciate you converting it to the "windows crowd" as well as "spelling it out" for me in the format you wrote it all out in your post. I, myself, have root and use TWRP for the backups...I was just trying to expand the knowledge...
Thanks again!

Categories

Resources