Backing up apps / data (plus archiving/restore idea) - G1 Android Development

Ok, even though I have market and browser cache being saved to my sdcard, I still occasionally run into space issues due to the small /data partition. Prior to removing apps, I decided to back up my apps and data.
I have backed up my data partition using:
busybox tar -cvf /sdcard/data_backup_20081206.tar /data
After saving a copy to my computer via USB, I did MD5 checksum checks to make sure no corruption during the copy. I still need to do tests to see if I ever have corruption based on the thread in this forum.
* Anyone else making backups using other methods (rsync, etc.)?
--------------------------------------
This got me thinking to some other phone OS's that don't really run apps from SDCARDS, but rather store them and copy them to the phone prior to running them.
I would think that we could (with root access) write an app that moves files from the /data folders to a /sdcard/dataarchive folder, when you wanted to archive an app you don't use much and wanted to save space. Then the Archiver app could restore the files when you eventually wanted to run the app.
* Is there an easy way to see what files are used by each app? Someone mentioned a manifest file at one point.
For example, it looks like neocore is at minimum using:
/data/dalvik-cache/[email protected]@[email protected]
/data/app/com.qualcomm.qx.neocore.apk
/data/data/com.qualcomm.qx.neocore
* Is there a thread someone could point me to that better explains the whole APK packaging and storage of applications and their data?
** Is the structure usually just as above, except just replacing com.qualcomm.qx.neocore with the proper app name?
** When do things get saved to app-private?
O' great community... thanks for your help.
-oldsk00lz

i was looking for a way to synch my /Music and my /Pictures so I came across this blog. im mounting the g1's sdcard on a linux machine in this scenario
http://philnelson.name/tag/rsync/
heres my script that i use. hope this helps a little.
Code:
#!/bin/bash
echo "Syncing /Music /media/FC30-3DA9/Music for updates to /media/E0E4-AA14................................................................."
rsync -rvv /media/FC30-3DA9/Music /media/E0E4-AA14
echo "Syncing /Music /media/E0E4-AA14 for updates to /media/FC30-3DA9/Music................................................................."
rsync -rvv /media/E0E4-AA14/Music /media/FC30-3DA
echo "Syncing /Music /media/E0E4-AA14 for updates to /media/FC30-3DA9/Music................................................................."
rsync -rvv /media/E0E4-AA14/dcim /media/FC30-3DA9/Pictures/g1Cam

Related

[HOWTO] MANUALLY save/backup apps and games and more importantly their PROGRESS

Well I browsed through all the forums and I could not find anything that I am going to explain. There are some tits-bits here and there, but I hope this proves to be useful.
I will also explain if you have a xrecovery backup, then how to extract your games and progress from there.
Many of you might be switching ROMs very frequently or upgrading/downgrading their Android. While doing this, we lose all our apps and games and more importanly the game's PROGRESS, if we do not save them.
There are apps available to save apps/games and progress but there is a way to do all these thing MANUALLY. This for those who want the control in their hands , like me.
PART A:
Here's how you do:
1) Create a backup folder on the sdcard with a name that you like. eg. mybackup
1) from your filemanager or from the shell, browse to the directory /data/app and do ls -l. You will get a list of apps which you have installed.
2) Select the app that you want to save/backup and move it to sdcard folder that you have created. The names here would be long but it will be almost similar to the name you see in the UI.
For eg.
Code:
cp uk.co.aifactory.moveitfree.apk /sdcard/mybackup
. would be the command to backup Move It game.
3) Now go to the the directory /data/data and do a ls -l. browse through the list and find a directory which matches the name of the apk without the .apk extension.
for Eg. for the 'move it' game, you will find a directory uk.co.aifactory.moveitfree
Move this directory to the backup folder
Code:
cp -r uk.co.aifactory.moveitfree /sdcard/mybackup
.
For those working on shell, remember to do cp "-r" as you are copying a directory.
You are done!!. You have backed up your app and all the progress related to that app.
Now you can copy mybackup folder to your PC or keep it in the sdcard if you have enough space. Its your choice...
PART B:
How to get the progress and games back after flashing the ROM or after wipeout.
Its easy. Just reverse the steps mentioned above.
1) copy the .apk file from your backup folder to /data/app through filemanager or shell.
Eg.
Code:
cp /sdcard/mybackup/uk.co.aifactory.moveitfree.apk /data/app
2) copy the data directory to the location /data/data.
Eg.
Code:
cp -r /sdcard/mybackup/uk.co.aifactory.moveitfree /data/data
You are back to business, just browse through your apps and enjoy the games from where you left.
UPDATE :
For Angry Birds, when you are done with the above steps, delete the file
/data/data/com.rovio.angrybirdsrio/files/settings.lua
It app will not open up if you dont do it.
-----------------------------------------------------------------------------------------------------------------
Those who have already backedup their ROMs and not saved their apps as mentioned above, dont worry, I have a solution for that too. I am specifically going to explain the method to get it from xrecovery backup.
When you backup your ROM or system using xRecovery, it stores all the data inside /sdcard/xrecovery/backup/<date>.
Inside that folder, there are 3 img files.
cache.img
system.img
data.img
data.img contains all the data/app/games that you had installed, while system.img contains everything that came bundled with ROM. It might differ a bit per devices, but mostly its data.img
I tried to open this file ".img" with a lot of extraction tools but none could help. Atlast, i got help from our great <zdzihu>, and he said, he saves the archive with yaffs2 compression.
There is an app "unyaffs2" which you can use to extract the contents of the archive. Get it from here http://forum.xda-developers.com/showthread.php?t=910255
This app will extract the contents to the folder where you ask it to. Once you have your data, repeat the above mentioned steps to get your apps and games running!!
Thank you for the how to
it not change owner
this is very big problem
Hi dateno1, can you be more specific?
What app are you trying on
What method u used to copy
What error r u getting exactly
Which device and on which step
Sent from my X10mini using XDA App
ronaksv said:
PART B:
How to get the progress and games back after flashing the ROM or after wipeout.
Its easy. Just reverse the steps mentioned above.
1) copy the .apk file from your backup folder to /data/app through filemanager or shell.
2) copy the data directory to the location /data/data.
You are back to business, just browse through your apps and enjoy the games from where you left.
Click to expand...
Click to collapse
i have question on the process of getting it back.
on step 1 you said copy.
is it also ok if you are going to reinstall it then proceed to step 2.
thanks.

Now that root is getting closer, PLEASE BACK UP!!

If you want to delete an app, change a file or whatever when you get root, please be smart about it. Think before you delete something. Have a plan B (a failback plan). If you don't know how you will fix whatever you're about to potentially break, DON'T DO IT.
Try to learn ADB. I know it's not for everyone, but it may pull you out of the fire later. Think before you do anything.
No matter what Android device it is, someone always has a post saying "Help! I deleted <insert app here> and I need it back!" Here are some tips:
Don't freeze or delete an app using Titanium Backup without knowing if it will crash your phone or not
If you're using ADB, rename a file instead of deleting it if you're not sure if it will crash your phone or not
Your /system folder is like the base operating system folder (think C:\Windows); before you change something BACK IT UP!
Code:
adb pull /system <destination_folder>
Since we only have temp root for now, if you're disabling packages, back up the packages.xml file
Code:
adb pull /data/system/packages.xml <destination_folder>
Learn from others' mistakes; if someone bricks their phone, read the thread and figure out how NOT to screw yourself and your phone
Heard of measure twice, cut once? Read three times, execute once. Listen to the Devs. Be nice to them. Don't piss them off. They do this on their own time.
Please be smart about whatever you do to your phone. We can't be dumb smart phone users. If you don't know something, ask in the appropriate section or thread. If you know something, don't tease others for not knowing. The occasional flame is funny and all, but at some point someone has to learn whatever they don't know - someone is going to have to step up and help them.
Thanks dawg...
I think and SD backup and Nandroid recovery backup on root will be good enough? <not condascending...just asking from your adb opinion?>
ROM_Guest said:
Thanks dawg...
I think and SD backup and Nandroid recovery backup on root will be good enough? <not condascending...just asking from your adb opinion?>
Click to expand...
Click to collapse
I think of that as another layer. We're not there with the Sensation yet, but I always think it's a good idea to use any and all methods best suited for what you're doing.
For example, if you're flashing a theme someone customized which could change multiple apk and jar files, a Nandroid backup is best.
When someone goes to remove an apk or freeze an app, they usually don't think to take a Nandroid backup (because deleting or freezing takes only a second - Nandroid backups take longer).
1) we don't have that functionality yet and 2) it's very common for someone to try to freeze a critical app which can cause a boot loop, which can easily be fixed by adb (if a Nandroid is not available).
i tried:
adb pull / backup/
it started building a file list and then started the copy. after a time (dont know excatly when because i let it run beside) it stoped working at:
pull: /sys/devices/platform/msm_adc/batt_id -> backup/sys/devices/platform/msm_adc/batt_id
nothing more happend. now i got 4883 files, a total of 3.1 GB, backup directory. but it seems not all files are in. when i browse through the phone dir i see much more files in the dirs.
is there any other way of getting a complete backup? when i rerun the command will it skip the files it allready dumped to disk? any other command?
thx!!!
daSn00p said:
i tried:
adb pull / backup/
it started building a file list and then started the copy. after a time (dont know excatly when because i let it run beside) it stoped working at:
pull: /sys/devices/platform/msm_adc/batt_id -> backup/sys/devices/platform/msm_adc/batt_id
nothing more happend. now i got 4883 files, a total of 3.1 GB, backup directory. but it seems not all files are in. when i browse through the phone dir i see much more files in the dirs.
is there any other way of getting a complete backup? when i rerun the command will it skip the files it allready dumped to disk? any other command?
thx!!!
Click to expand...
Click to collapse
All you really need is /system and /data if you want a complete backup. I know you see other files+folders, but those are mounted by the OS and kernel... or whatever. Someone with more Linux experience can explain better than I can. But if you want a complete backup, just get /system and /data.
The /system folder is like getting the base OS. The /data is all your user/personal data.
dumping /system worked fine: 1366 files pulled. 0 files skipped.
when trying to dump /data it freezes again and allways again at:
pull: /data/d/smem_log/dump_cont -> ../backup2/data/d/smem_log/dump_cont
so i dumped every dir in data manually only /data/d is missing now. but there are so many dirs in it, i dont want to dump every dir on its own
any idea?
daSn00p said:
dumping /system worked fine: 1366 files pulled. 0 files skipped.
when trying to dump /data it freezes again and allways again at:
pull: /data/d/smem_log/dump_cont -> ../backup2/data/d/smem_log/dump_cont
so i dumped every dir in data manually only /data/d is missing now. but there are so many dirs in it, i dont want to dump every dir on its own
any idea?
Click to expand...
Click to collapse
That should be good enough for now. No one else is doing this manually, so until we get an official root this is all you can do to backup. Once we get permanent root, titanium backup will do most of this for us.
I would only make backups of anything you change or delete at this point, but that's just me.
Sent from my HTC Sensation 4G using XDA App

[Q] EEE - how to dump everything?

I don't know if ADB is even the best tool to do this, but I want to be able to copy the entire file system off the EEE pad onto a pc. I want everything, starting from the "/" root directory. I want the entire file system and all files copied over so I can work with them on the pc.
I have root (verified by # when entering adb shell and various root apps successfully running.)
My thought was to do "adb pull /" from a dos shell (running windows 7), but not everything copies over. I get lots of messages about "skipping special file", I dont get the /data/data directory, etc etc.
Is there a tool or some way to copy over the entire file system starting from "/" ?
Thank you.
Nvflash will let you download the APP partition which is the system folder. It's an ext4 filesystem that you can mount and poke around.
USP is the data partition.
Be careful not to format your TF!
Clockwork mod will backup the system.img and you can either mount or unyaffs this. I forget which one. Same for data.img
sent from my cyanogen(mod) vision
Is the data.img same as the USP partition? Is the system.img same as the APP partition?
which I can then mount and explore?
I don't want to edit anything, I only want to examine.
In particular, I want to take a snapshot of all the files and filesystem (directory structures, files, etc) before an app is run. After the app is run and exited, I want to take another snapshot and look at what has changed. If there are new files created, existing files edited, etc. I want to search for strings (grep), etc.
I was hoping I could copy all the files to do this, but perhaps there is another way like one of those you suggested (nvlash, clockwordmod, ??)
Thank you.
Nvflash and clockworkmod wouldn't be used on a running system. You might want to look in the /proc and caches, but I'm not an expert on this.
sent from my cyanogen(mod) vision
gee one said:
Nvflash and clockworkmod wouldn't be used on a running system. You might want to look in the /proc and caches, but I'm not an expert on this.
Click to expand...
Click to collapse
Expert or not, I really appreciate your advice.
I took your initial suggestion to be to use NVflash and/or clockworkmod to make backups of the device. It seems from some other threads I've read that the tablet drive consists of up to 15 or 16 partitions, two of which are USP and APP.
So conceivably I could back those up "before", and mount the backup images somewhere to look at, preferably on a pc.
Then, I could install and run the app in question, and use NvFlash and/or CWM again to make backup images, and look at them for comparison.
On another note, I tried installing busybox and running cp to move, for example, /data to the external SD card, but I think I need a bigger SD card.
I wonder if
busybox cp / /Removable/MicroSD/targetdirectory
would work to copy everything?
The danger with that is that some directories and files are virtual- /proc and I think /var are virtual directories. Files like dev/null dev/zero would be problematic!
You might want to do specific parts, such as /data, or even /data/data/your.app's.java.name.here
You could use "find ." and write a script to pull everything with adb, but it would take forever, so it might not be a true snapshot.
Have you looked at the ddms or some of the other tools in the android SDK?
Sorry to confuse. By snapshot I did not mean screenshot. I meant just a record of the state of the device at that point in time. Meaning, all the files before the app was run. Then all the files (any new ones, changes to existing ones, any deleted) AFTER the app was run. I want to look at what has changed.
Still, thanks for the ddms idea. I have to look at any other tools in the adb environment that could be useful.

Cannot delete files or folders within /data/data/

Setup: CROMI 3.4.7 with Data2SD
I am having issues deleting folders and files within the /data/data/ portion of my file structure. I have tried with both th File Manager HD and ES File Explorer but I keep getting messages saying that I am unable to delete those folders and files.
The reason I am trying to delete this is because I was unable to install certain apps, and continually got an error message during installation that said:
Unknown error code during application install: "-24"
From searching forums, I found that the issue is that previous installations (I guess I forgot to do a factory reset before reflashing a ROM) left certain system folders and files for certain applications, which prevented a fresh installation from taking place. Other users have resolved this issue by deleting the relevant files in the /data/data/ section of their tablet.
I have circumvented the issue by renaming those folders (which for some reason works), but still cannot delete those renamed folders. I've tried messing with the permissions, but still no luck.
Any ideas?
Possibly an ownership problem?
Boot into recovery, plug in the USB cable, go into adb shell. Make sure that /data is mounted. Then do something like:
cd /data/data
chown -R media_rw.media_rw *
Might wanna backup first...
danger-rat said:
cd /data/data
chown -R media_rw.media_rw *
Click to expand...
Click to collapse
Don't do that if you want any apps to work afterwards.
Eeeeek, good catch!
I was thinking data/media.
You could do this just for the specific folders you want to delete, but not all...

[Help] Changes to /system won't stick, even after mounting as rw

I've posted about this on StackExchange here (http://android.stackexchange.com/q/157846/126804) but it seems no one can/bothers to answer it. More details are available in the link.
I'm currently trying to convert some user apps into system apps. I've successfully moved the apps into /system/app by making a NAND image and mounting it on Linux, but it throws an error when I try to launch those apps (ClassNotFoundException, something about missing dex). I've already set the permissions the same as the other apps inside /system/app.
Another thing that I've noticed is that I can make any change to /system (copying files, editing, renaming, etc.), but everything gets wiped after a reboot. The same happens with another partition named /custpack (this is what the OEM uses to fill the phone with boatware). I've also tried to place the apps there, but same thing.
How can I debug this?

Categories

Resources