Hello,
I am a junior ROM's cooker and I do many resets on my terminal.
This forced me to configure all the applications each time, and I really don't like the backup application that is not exactly what they do ...
So I made my own script to backup/restore (which I now share), and can be used either for a manual backup//restore and to automate backups via cron.
My Samsung Galaxy S2 ROM includes support for cron commands, and I have programmed the cron to make a backup of the (configured) apps data each hour, but this is not necessary.
Also, the command test if a backup is outdated before recreate.
You can use the command for backup
backup-restore-apps-data.sh --backup
Click to expand...
Click to collapse
or to restore a previously backup
backup-restore-apps-data.sh --restore
Click to expand...
Click to collapse
In order to configure, you can make a
directory "backup-data-data" in the root
of the sdcard.
Next, you need to create a serie of directories
for each application that you're interested on preserve
(the name of the directory is the name of the
application package [com.android.browser, by example]).
Enjoy!
Related
Hey everyone,
I just whipped up a quick Java based app that you can back up and restore your apps that you installed (the ones in the /data/app and /data/app-private dirs) It also backs up the settings for those apps.
I'll be adding in saving settings for apps that are in system/app later, but I thought this one was ready for a release.
You must have the /tools dir of your SDK in your path var in order for this to work.
Please verify that adb is detecting the device by running "adb devices" and make sure this there.
Un-archive the the zip and it will have a AppBack-x.x.class file in it
Usage is for backup run "java AppBack backup"
And for restore is "java AppBack restore"
This will create a dir "appback" with two dirs in it, "backup" contains the apk's and "settings" contains the app data.
If there's something you'd like to see, just post and I'll do as much as humanly possible to add it in
Note: Error handling is nasty, and future versions will be nicer (shocker isn't it )
(also, when you run it first you might get a operation not permitted error, just run it again and it *should* resolve itself, I'll fix it in the next release.)
I'm writing this right about when I should be sleeping, so I probably forgot something lol, but yeah, if you encounter an error, please report it.
Thanks alot!
Aakash Patel
Oh and btw, you might have to rename the class file to "AppBack.class"...
Nice, this should be handy, will definitly check out on my next flash. Does it handle setting the correct user owner/permissions on the folders in the data directories on a restore?
This is great, but maybe in the future let user choose what apps to backup and their settings.
Oh haha I forgot to mention that important part, you have to have root! >_<
so uh.. where does it create the appback directory, and how exactly are you supposed to run it... from the device or from a console or what.. i think i ran it but im not sure and im looking all over for a appback directory
Just a quick note to everyone who is constantly switching between ROM's with their 'daily driver' phone.
Make sure all of your apps are backed up using Astro or AppControl. They will be backed up to /sdcard/backups/apps.
Once your new ROM is installed, and your phone has been wiped, mount your SD card on your PC.
Open a command prompt and navigate to the \backups\apps folder on your SD card.
(this assumes that your adb.exe is in your PATH)
In the command prompt, type in:
for %%f in (*.apk) do adb install %%f
Watch all of your apps install! This really saves a lot of time over using Astro or AppControl to re-install all of your apps.
Absolutely brilliant!
I've done this dozens of times over the last couple weeks. I felt so dumb finding this little snippet of code after manually installing 100+ apps every time I wanted to try a new ROM.
Huh, how about a script to back up via adb? Or backup/restore app data?
Actually, the latter is far more important =P.
I think easy backup restore is with astro file manager...
SpaceBoy2000 said:
Huh, how about a script to back up via adb? Or backup/restore app data?
Actually, the latter is far more important =P.
Click to expand...
Click to collapse
That's more difficult since the data is stored in a DB inside Android (for most apps, anyway). I noticed there is a sqlite3.exe inside the Android SDK so I assume you can query the DB using that and extract certain data, for example SMS and call history, just need to invest a bit of time reading up I think!
Hi,
I'm new to the business and I spent some time to learn the environment trying different applications and different approaches for almos every action I took. Today, I have not much bigger knowledge, but I finally decided to take few things in my own hands because existing software is not fulfilling my wishes.
I started with this simple script which eases the pain of reinstalling all applications after ROM upgrade. There are few such tools already, but I found those quite bloated with unnecessary thing for my own approach.
With this script I assume:
1. There is/was SSHDroid installed (or any tool with busybox and you can access shell command line) both in old and new ROMs and your ROM have bash installed in /system/bin/.
2. Backup/restore operation includes only INTERNALLY installed applications, it completely ignores SYSTEM and SDCARD installed ones.
3. This is TEMPORARY backup so it should be as fast as possible not caring about occupied space (!). Althought I added -zip parameter to enable compression if you are running out of space on your sd.
4. Installed ROM is clean with no additional apps installed (excluding those needed by the script)
5. You have basic knowledge about bash scripting, because I take NO RESPONSIBILITY of the script behavior or data loss it can do.
So, basically it is simple. It runs like this:
1. On old ROM type: sbackup -backup
2. Flash your ROM
3. On new rom type: sbackup -restore
Just like that. The applications data is tar'ed in one file per application so if you want to get rid of any, just delete it from backup directory. The directory name is same as script name on sdcard but you can change it adding a parameter without a '-' sign at runtime (first non-option parameter is treated as backup directory path). The file is zipped because this forum disallows files without an extension so... it is zipped ;D
It was tested on my fresh LeeDroid 3.3.3 GB AFTER i installed some apps. I backed them up and then restored. All seems to be perfect right now, but I will test it more thoroghly very soon because I'm planninig to have CM7 based ROM too just to choose that I need Sense or not (two nandroids for fast switch weekly ;P).
With this script and MyBackup functionality of backing up contacts, sms, history and similar it should be quite complete approach to restore all the data needed on the fresh ROM. In the future maybe I will look at the MyBackup part too. Maybe.
Feel free to comment, use, suggest or anything you like, and have fun ;P.
How do I run this script? Do i run it from sdcard or from system /bin? When i do it from system bin it says cannot create directory. When i run it from sdcard/sbackup it says permissions denied?
Sent from my ADR6400L using Tapatalk
jgrimberg1979 said:
How do I run this script? Do i run it from sdcard or from system /bin? When i do it from system bin it says cannot create directory. When i run it from sdcard/sbackup it says permissions denied?
Sent from my ADR6400L using Tapatalk
Click to expand...
Click to collapse
And thats why I mentioned in topic about not being a newbie (and I meant not forum newbie but more a linux newbie). The thing is, it's a simple script - without any user-proof capabilities, comments inside or something BUT...
But ok, I will try to help you run it. First of all, you have to set permissions to the script. It has to have executable permission to be run by the system (and I mean filesystem permission). This can be done by chmod instruction of busybox. Most of the times it's done like this:
chmod 755 filename
This is a reason of not running form sdcard if your sdcard is NOT ext filesystem (it is usually windows fat filesystem not to generate problems with reading it under windows).
Second thing to run is to have /system/bin/bash because first line of the script (a comment like this: #!/system/bin/bash) instructs busybox to execute script using bash. This can be simply changed by modifying this line, but you have to remember that changing the shell executing script have consequences. Differens shells have sometimes different syntax, althoght i wrote this script simply so it should run on most of them, especially sh.
Third thing is to have write permissions to the directory in which the backup will be created. In original version of the script it is /sdcard, because backup is made in /sdcard/sbackup. So, you have to check it (second error - problems with creating directory).
And a last tip - it can be run from ANYWHERE. Even if your partition does not alolow executing, you can do it like this:
bash-3.2# /sdcard/test
bash: /sdcard/test: /system/bin/bash: bad interpreter: Permission denied
bash-3.2# . /sdcard/test
OK
bash-3.2#
First try does not succeded, but second did. The trick is a dot which means to execute file with a shell not caring about why or permissions.
And thats most simple introduction I could write. It applies to ANY script you want to run.
Please anyone - if you want me to help, paste your results here because without a precise error message it can be very hard to deduce what caused for example permission denial or anything usual.
For now, I won't add any more error handling, but if there will be more users caring about, I will add it.
I'm a complete beginner when it comes to rooting, flashing and so on. I've been using my Nexus 4 since the day it came out, and have always had it completely stock, never even rooted it or anything. I'm normally not too bad at stuff like this, but I've been googling how to do all of this and been reading some guides on here, and I'm just getting more and more confused.
My goal is to go from Stock Android 5.1.1 to the newest Cyanogenmod nightly, and to keep all my data. Now, how do i go about this?
I'm already stuck at the first step (or at least I think, that's the first step): Creating a backup of my current Stock phone. Apparently I need to create a NANDROID backup first, but I can't do it with a locked bootloader? And if i unlock the bootloader, my data will be wiped? This alone seems completely illogical to me, because how am I going to backup my device then? Is there no simple step by step guide for Nexus devices, that includes EVERYTHING, from backup to the final flashing of the ROM?
This is a good guide http://forum.xda-developers.com/showthread.php?t=2018179
I've seen it and it doesn't answer my question. How do I unlock the bootloader to create a backup, without wiping my device?
jb91 said:
I've seen it and it doesn't answer my question. How do I unlock the bootloader to create a backup, without wiping my device?
Click to expand...
Click to collapse
You can't unlock the bootloader without wiping the device. The only backup you will be able to make without an unlocked bootloader is copying your sdcard to your pc and use an app like helium to backup your apps and data. Just remember to copy that backup to your pc as well, otherwise it will be wiped.
theminikiller said:
You can't unlock the bootloader without wiping the device. The only backup you will be able to make without an unlocked bootloader is copying your sdcard to your pc and use an app like helium to backup your apps and data. Just remember to copy that backup to your pc as well, otherwise it will be wiped.
Click to expand...
Click to collapse
Thanks. Do you know this "Nexus Root Toolkit" program? I was able to create a backup file containing all apps with it, as well as extract a file with my contacts data from my Nexus 4. I'm guessing this should also include my SMS / WhatsApp messages and so on?
jb91 said:
Thanks. Do you know this "Nexus Root Toolkit" program? I was able to create a backup file containing all apps with it, as well as extract a file with my contacts data from my Nexus 4. I'm guessing this should also include my SMS / WhatsApp messages and so on?
Click to expand...
Click to collapse
Unfortunately I don't know much about that. You could skim through some of the thread or search to find out if someone else has asked that question and if not ask it there. That would probably be the easiest way to find out.
This is extremely confusing, I have no idea how people can say it is simple to put a custom ROM on a Nexus device. I am absolutely lost trying to back up everything. Is a NANDROID backup just a full backup of the phone? Am I not completely screwed if I can't create this? I have some random app files, extracted from a Root Toolkit, and a contacts file. I don't think that's enough to save my device in case anything goes wrong during flashing?
One of the sticky threads here mentions this right at the beginning:
Before you do anything EVER, you'll always have to backup your stuff, even if you don't feel like it, or your dog died (in which case I'm truly sorry), but, no matter what you're about to do, always have a recent backup sitting around.
There are many ways and things you can and will probably have to backup.
1. Backup your entire phone, by creating a Nandroid Backup.
As you saw in the 'Custom Recovery" picture above, you have a "Backup and Restore" option.
Click to expand...
Click to collapse
But it doesn't make any sense. "Before I do anything", I can't even create the NANDROID backup to begin with, because the bootloader is not unlocked by default, and unlocking it will wipe everything on the device. So I don't get how the first step to put a ROM on a phone is to create a NANDROID backup, because from my understanding, it is not possible to do. Also, my Nexus 4 did not come with a "custom recovery" installed and I have no idea how to put this on there (do i do this before or after the NANDROID backup?). I'm really starting to wonder how anyone actually understands these guides.
jb91 said:
This is extremely confusing, I have no idea how people can say it is simple to put a custom ROM on a Nexus device. I am absolutely lost trying to back up everything. Is a NANDROID backup just a full backup of the phone? Am I not completely screwed if I can't create this? I have some random app files, extracted from a Root Toolkit, and a contacts file. I don't think that's enough to save my device in case anything goes wrong during flashing?
One of the sticky threads here mentions this right at the beginning:
But it doesn't make any sense. "Before I do anything", I can't even create the NANDROID backup to begin with, because the bootloader is not unlocked by default, and unlocking it will wipe everything on the device. So I don't get how the first step to put a ROM on a phone is to create a NANDROID backup, because from my understanding, it is not possible to do. Also, my Nexus 4 did not come with a "custom recovery" installed and I have no idea how to put this on there (do i do this before or after the NANDROID backup?). I'm really starting to wonder how anyone actually understands these guides.
Click to expand...
Click to collapse
Following the link to the guide, I see this:
*****
Unlocking the Bootloader:
***NOTE***
This will perform a factory reset on your device. You will lose all applications. Even the data on your SD Card! I'd recommend making a Backup to your computer BEFORE performing this. There is a method for backing your data up, detailed HERE.
For the time being, there is a method available that will allow you to unlock your device (and root it) without losing your data.
For instructions, click HERE. Please note: this is a hack and isn't the "conventional" and "accepted" way of unlocking your bootloader on a nexus device. The wipe requirement is there for your safety, really, and I'm certain this will be patched in the upcoming releases.
*****
But you can always use adb directly from your pc to backup your entire device. How? adb --help
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
- write an archive of the device's data to <file>.
If no -f option is supplied then the data is written
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)
(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default
is noobb.)
(-shared|-noshared enable/disable backup of the device's
shared storage / SD card contents; the default is noshared.)
(-all means to back up all installed applications)
(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)
(<packages...> is the list of applications to be backed up. If
the -all or -shared flags are passed, then the package
list is optional. Applications explicitly given on the
command line will be included even if -nosystem would
ordinarily cause them to be omitted.)
greg17477 said:
But you can always use adb directly from your pc to backup your entire device. How? adb --help
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
- write an archive of the device's data to <file>.
If no -f option is supplied then the data is written
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)
(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default
is noobb.)
(-shared|-noshared enable/disable backup of the device's
shared storage / SD card contents; the default is noshared.)
(-all means to back up all installed applications)
(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)
(<packages...> is the list of applications to be backed up. If
the -all or -shared flags are passed, then the package
list is optional. Applications explicitly given on the
command line will be included even if -nosystem would
ordinarily cause them to be omitted.)
Click to expand...
Click to collapse
Is ADB this "Android Studio" that I had to install in the first step of this guide (Android SDK)? If so, I opened it but I have no clue how to get anywhere where i could enter code like this. This is what it looks like: http://i.imgur.com/zhujSKR.png
jb91 said:
Is ADB this "Android Studio" that I had to install in the first step of this guide (Android SDK)? If so, I opened it but I have no clue how to get anywhere where i could enter code like this. This is what it looks like: http://i.imgur.com/zhujSKR.png
Click to expand...
Click to collapse
Sorry, i can not help you , if you do not know the basic of basics Lots to read up for you.
cheers
Well ok, lets try it another way: i don't understand how to create a full backup, but i did backup some single apps to my PC using Nexus Root Toolkit (they're .ab files), for which i want to keep my data. I also manually backed up my mp3s and pictures / videos. Would i be fine just starting with the actual process (unlocking bootloader, install custom recovery and so on)?
After all, i should have the possibility to revert anything back for these apps at least, and the official Nexus 4 Stock Android files are available at Google. So, there's no real risk, even without a FULL backup of everything, correct?
Hi guys, I've searched extensively but haven't found a specific answer to this. I know I can do a data backup and restore using:
Code:
adb backup -apk -shared -all -f backup.ab
Even this skips some files, settings, logins, etc. Setting up a new phone just like my last with all my data and logins to 436 apps is the bane of my life (and many Android users!)
Is there a way to do a full data backup of the user data partition as one partition file, or some other more robust way, that I can then duplicate/clone/restore to a new device or after wiping the current device? Maybe with Odin or a similar tool?
CJSnet said:
Hi guys, I've searched extensively but haven't found a specific answer to this. I know I can do a data backup and restore using:
Code:
adb backup -apk -shared -all -f backup.ab
Even this skips some files, settings, logins, etc. Setting up a new phone just like my last with all my data and logins to 436 apps is the bane of my life (and many Android users!)
Is there a way to do a full data backup of the user data partition as one partition file, or some other more robust way, that I can then duplicate/clone/restore to a new device or after wiping the current device? Maybe with Odin or a similar tool?
Click to expand...
Click to collapse
Try Titanium BU, thats the best way to do a backup! You can save it to ext-sd-card an restore it every time!
McTaumel said:
Try Titanium BU, thats the best way to do a backup! You can save it to ext-sd-card an restore it every time!
Click to expand...
Click to collapse
And what without root?
MisterKanister said:
And what without root?
Click to expand...
Click to collapse
Helium app does the job!
suparuss said:
Helium app does the job!
Click to expand...
Click to collapse
But helium cannot backup some user apps (some apps are disallowed for backup), and it doesn't backup any system app...