[UTIL] BART-1.3.1 Backup and Restore Tool

Search This thread

dumfuq

Retired Recognized Developer
May 23, 2009
542
42
This script is based off of devsk's switchrom.sh found here: http://xdaforums.com/showthread.php?t=541183. If you are unfamiliar with switchrom, you should probably read that thread first.


Requirements:

1) cyanogen's 1.4 recovery image, Amon_Ra's recovery image, or any other that is based off of the 1.4 recovery image.
2) an extended partition isn't required but makes it easier.


Installation:

rename bart-*.txt to bart.sh
copy bart.sh to /system/sd/
for example:
Code:
mv /sdcard/download/bart-0.9.8.txt /system/sd/bart.sh
note: if using Amon_Ra's 1.2.3 recovery, bart-0.9.2 is already included. Either type 'utility' into the console or invoke bart without sh, file extension, or path. For example: "bart -s myrom" instead of "sh /system/sd/bart.sh -s myrom".

Optional: Create config file named bart.config and place in /system/sd/


Features:

ability to store/restore ROMs based on name
store/restore all made default (nandroid and entire ext partition)
ability to customize the store/restore process

The main difference between the different restores is what data is deleted before the restoration process, not what is restored. The ext backup is kept in a single tar/tar.gz file and is extracted after deleting whatever the user chose to delete.

-r: deletes entire ext partition (rm -rf *)
-b -r: deletes apps folders and dalvik cache (rm -rf app* dalv*)
-a -r: deletes apps_s and dalvik cache (rm -rf app_* dalv*)
-n -r: deletes nothing from /system/sd

This version stores backups in /sdcard/bart. If you want your old switchrom backups available to you, just copy or move them there.

Code:
mkdir /sdcard/bart
mv /sdcard/switchROM/* /sdcard/bart/
Usage:
sh /system/sd/bart.sh [--noninteractive] [options] -s|--store [rom_name]
sh /system/sd/bart.sh [--noninteractive] [options] -r|--restore [rom_name]
sh /system/sd/bart.sh [--noninteractive] -d|--delete [rom_name]
sh /system/sd/bart.sh -l

Options:
-a|--apps_s
-b|--base, nandroid apps dalvik_cache
-c|--compress, only used with -s
-e|--ext_only
-h|--help
-n|--nandroid_only
-v|--version
--verbose
--nocache
--norecovery
--noboot
--nodata
--nosystem
--noninteractive
--reboot, only used with -r or -s
--shutdown, only used with -r or -s

Always specify options as separate words"
e.g. -c -r instead of -cr. It is required!
-r and -s need to be last or followed by rom_name.
--noninteractive needs to be first.

Don't use spaces or special characters in rom_name.
Compress will take longer but image will be smaller.


Examples:

store a complete backup, prompt for rom_name (nandroid and entire ext partition)
Code:
sh /system/sd/bart.sh -s
store nandroid, /system/sd/apps*, and /system/sd/dalv* (original switchrom behavior)
Code:
sh /system/sd/bart.sh -b -s
store nandroid only and name it mycy_nand
Code:
sh /system/sd/bart.sh -n -s mycy_nand
store complete ext partition only
Code:
sh /system/sd/bart.sh -e -s
store /system/sd/apps* and system/sd/dalv* only
Code:
sh /system/sd/bart.sh -b -e -s
store nandroid, /system/sd/apps_* and system/sd/dav* only
Code:
sh /system/sd/bart.sh -n -a -s
restore complete backup (nandroid and entire ext partition)
Code:
sh /system/sd/bart.sh -r
restore nandroid, apps folder, and dalvik-cache (original switchrom behavior)
Code:
sh /system/sd/bart.sh -b -r
restore entire ext partition only
Code:
sh /system/sd/bart.sh -e -r
restore /system/sd/app* and /system/sd/dalv* (not nandroid, only apps* dalv* folders cleared first,rest of ext partition left intact)
Code:
sh /system/sd/bart.sh -b -e -r
delete a backed up rom
Code:
sh /system/sd/bart.sh -d
list available roms
Code:
sh /system/sd/bart.sh -l
Changelog:
bart-0.9.1.sh: fixed bug where old nandroid backups were retained when same name was used.
bart-0.9.2.sh: added battery level check before restoring to avoid it crapping out midway during restore process.
bart-0.9.3.sh: added ability to send nandroid norecovery, noboot, nodata, and nosystem flags. Added verbose mode option for nandroid backup/restore.
bart-0.9.4.sh: added ability to delete ext-backup or nandroid separately. Added extra output for verbose mode.
bart-0.9.5.sh: added non-interactive mode
bart-0.9.6.sh: added option to backup/restore app_s, dalvik-cache, and nandroid
bart-0.9.7.sh: no longer tries to mount ext partition when -n option is given.
bart-0.9.8.sh: checks whether or not it is in recovery mode, increased verbosity for verbose mode, code cleanup.
bart-1.0.0.sh: ability to reboot/shutdown after store/restore, minor code cleanup
bart-1.0.1.sh: removed recovery mode check since its not always accurate
bart-1.1.0.sh: can now source a user config file.
bart-1.1.1.sh: fixed the shbang
bart-1.2.0.sh: added ability to backup/restore cache.
bart-1.3.0.sh: cache backup is now default (cache option is now --nocache). Now works with recovery's that mount ext at either /sd-ext or /system/sd.

bart-1.3.1.sh: fix to properly source bart.config on sd-ext as well (/sd-ext/bart.config or /system/sd/bart.config)

Much thanks to Devsk.



_______________________________

Of course I'll take your money.

Or you could donate to others that helped me. Such as:
cyanogen, Meltus, Amon_Ra, rgv151, Rogro82, Loccy, manup456, and many more.
 

Attachments

  • bart-1.0.1.txt
    15 KB · Views: 952
  • bart.example.config.txt
    499 bytes · Views: 650
  • bart-1.1.1.txt
    15.2 KB · Views: 503
  • bart-1.2.0.txt
    17.6 KB · Views: 262
  • bart-1.3.0.txt
    17.7 KB · Views: 200
  • bart-1.3.1.txt
    17.8 KB · Views: 1,277
Last edited:

rondey-

Senior Member
Mar 3, 2009
125
0
Fort Worth
www.myspace.com
Use switchrom quite often (between cyanogen, xrom, and jacxhero). I am going to upgrade to this though.

Will I be able to just remove the old switchrom script and restore my backups made with switchrom? Or would I need to restore them with the switchrom script and then back them up with this script?

I just really hope cyanogen will integrate this into his recovery image soon. It works wonders. The only thing that bothers me is that I am lazy and dont like having to type to mount system/sd and what not :D

Edit: Nevermind see in the OP if they are moved to /sdcard/bart it will work, dont know how I missed that
 
Last edited:

palosjr

Senior Member
Jul 25, 2009
847
18
Houston
Use switchrom quite often (between cyanogen, xrom, and jacxhero). I am going to upgrade to this though.

Will I be able to just remove the old switchrom script and restore my backups made with switchrom? Or would I need to restore them with the switchrom script and then back them up with this script?

I just really hope cyanogen will integrate this into his recovery image soon. It works wonders. The only thing that bothers me is that I am lazy and dont like having to type to mount system/sd and what not :D

this sounds to me alot like switchrom on steroids lol... good work.
 

dumfuq

Retired Recognized Developer
May 23, 2009
542
42
just posted bart-0.9.1. Fixes a bug where old nandroid backups are retained when same rom name is used.
 

ESKIMOn00b

Senior Member
Apr 16, 2009
420
7
alabama
just posted bart-0.9.1. Fixes a bug where old nandroid backups are retained when same rom name is used.

Was this per my request in the switchrom thread? If so sweet, if not then rockon anyways cuz the damn issue is fixed, I looked one day and I had 100mb left on my sd card, the switchrom folder was like 6GB cuz old bkup NAND imgs that stacked up over a month of bouncing between CM and hero
 

dumfuq

Retired Recognized Developer
May 23, 2009
542
42
Was this per my request in the switchrom thread? If so sweet, if not then rockon anyways cuz the damn issue is fixed, I looked one day and I had 100mb left on my sd card, the switchrom folder was like 6GB cuz old bkup NAND imgs that stacked up over a month of bouncing between CM and hero

Yup. You instigated that one. Figured it was kinda a big issue for people who are always juggling space (like myself).
 

dumfuq

Retired Recognized Developer
May 23, 2009
542
42
So now if I were to be using cyanogen for three days and for whatever reason I switch to xrom, if I was gonna back up the cyanogen rom I don't need to delete my previous backup?

If you use the same name to store a rom, yes it will overwrite the previous backup with said name. The ext-backup.tar will be overwritten and the nandroid backup will be deleted before the new one is made.
 

ESKIMOn00b

Senior Member
Apr 16, 2009
420
7
alabama
Thank you sir!, any way you can point me in the direction of modifying the script so the default is just ap* dal*, versus the whole ext partition, have several files and other things in the ext partiton that I don't need older version over writing my current version by accident.... basically restore the way devsk's script backed up ext side, do I just move the variable for the condition from the conditional statement and recreate it as global and set it equal to 1? 0? I'm pretty good at c, java, and a few other languages so its not totally greek, just a little unfamilar.
thanks bro
 

dipeshb

Senior Member
Feb 13, 2006
207
9
Good Work!

I have an suggestion. I use switchrom all the time. Every time I back up, the whole of the ext is backed up every time..

I would like it if only the dalvik-cache and the app_s alone is backed up and restored, and the app and app-private is either left alone, OR restored from a central location..

This would enable me to switch between ROM's, but keep the up to date apps in their present state...

I never wipe the app and app-private when switching between ROM's so that any app updates I have previously performed, remain as they are.. The issue arises when I use switchROM.sh to restore an old build, this will restore my apps to that point in time, and I have to re-update them...

Just a thought... I was considering doing this myself, but a couple of attempts failed, so I will leave it to the PRO's to figure out..
 

overground

Retired Senior Moderator / Inactive Recognized Dev
Thank you sir!, any way you can point me in the direction of modifying the script so the default is just ap* dal*, versus the whole ext partition, have several files and other things in the ext partiton that I don't need older version over writing my current version by accident.... basically restore the way devsk's script backed up ext side, do I just move the variable for the condition from the conditional statement and recreate it as global and set it equal to 1? 0? I'm pretty good at c, java, and a few other languages so its not totally greek, just a little unfamilar.
thanks bro
If you throw the -b switch in there (base), it will only store/restore app* and dalv* folders to/from your EXT.

A naming convention I use is CMx.xx.x09-21-09 [store all]
CMx.xx.x09-21-09NB[nandroid-base]
CMx.xx.x09-21-09EB[EXT-base]...and so on...
 

pascanu

Senior Member
Jan 22, 2009
553
55
Tg. Mures
I tried using BART and this is what I get:

Code:
/system/sd # sh bart.sh -s
sh bart.sh -s
Please entere name for ROM.
test
test

Storing ROM test, proceed? (y/n) y
y
Storing app data...
tar: empty archive

Error occurred during storing of app data...
tar operation failed.
Do you have enough space on the /sdcard?

I have more than 2.5GB left on my SD card, my ext partition is 300MB, switchrom is working just fine, so what do you think my problem is?
 

overground

Retired Senior Moderator / Inactive Recognized Dev
I tried using BART and this is what I get:

Code:
/system/sd # sh bart.sh -s
sh bart.sh -s
Please entere name for ROM.
test
test

Storing ROM test, proceed? (y/n) y
y
Storing app data...
tar: empty archive

Error occurred during storing of app data...
tar operation failed.
Do you have enough space on the /sdcard?
I have more than 2.5GB left on my SD card, my ext partition is 300MB, switchrom is working just fine, so what do you think my problem is?
Are you running it through the recovery console? Also I'm not sure if it is a prerequisite to create /sdcard/bart folder prior to running the script. It says to in the OP, so that's what I did. I know switchrom created it for you. Try this in recovery:
Code:
mount /system/sd
sh /system/sd/bart.sh [-flags][romname]
 

dumfuq

Retired Recognized Developer
May 23, 2009
542
42
I tried using BART and this is what I get:

Code:
/system/sd # sh bart.sh -s
sh bart.sh -s
Please entere name for ROM.
test
test

Storing ROM test, proceed? (y/n) y
y
Storing app data...
tar: empty archive

Error occurred during storing of app data...
tar operation failed.
Do you have enough space on the /sdcard?

I have more than 2.5GB left on my SD card, my ext partition is 300MB, switchrom is working just fine, so what do you think my problem is?

I have been unable to recreate this.

1) Can you try from the phone itself (in recovery of course) not using adb?
2) Are you positive there is space left? `busybox df -h /sdcard`
 

madunix

Senior Member
Jan 16, 2009
571
70
New York
hopefully this can be added into the next recovery image once cyanogen gets some time together for it. he's been tweaking the **** outa his other roms. lol