Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,426 Members 53,422 Now Online
XDA Developers Android and Mobile Development Forum

[UTIL] BART-1.3.1 Backup and Restore Tool

Tip us?
 
dumfuq
Old
(Last edited by dumfuq; 5th May 2010 at 08:37 PM.)
#1  
Retired Recognized Developer - OP
Thanks Meter 43
Posts: 542
Join Date: May 2009
Default [UTIL] BART-1.3.1 Backup and Restore Tool

This script is based off of devsk's switchrom.sh found here: http://forum.xda-developers.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.
Attached Files
File Type: txt bart-1.0.1.txt - [Click for QR Code] (15.0 KB, 858 views)
File Type: txt bart.example.config.txt - [Click for QR Code] (499 Bytes, 598 views)
File Type: txt bart-1.1.1.txt - [Click for QR Code] (15.2 KB, 486 views)
File Type: txt bart-1.2.0.txt - [Click for QR Code] (17.6 KB, 242 views)
File Type: txt bart-1.3.0.txt - [Click for QR Code] (17.7 KB, 178 views)
File Type: txt bart-1.3.1.txt - [Click for QR Code] (17.8 KB, 1154 views)
 
rondey-
Old
(Last edited by rondey-; 19th September 2009 at 10:47 PM.)
#2  
Senior Member
Thanks Meter 0
Posts: 123
Join Date: Mar 2009
Location: Fort Worth
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

Edit: Nevermind see in the OP if they are moved to /sdcard/bart it will work, dont know how I missed that
 
palosjr
Old
#3  
palosjr's Avatar
Senior Member
Thanks Meter 9
Posts: 799
Join Date: Jul 2009
Location: Houston
Quote:
Originally Posted by rondey- View Post
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
this sounds to me alot like switchrom on steroids lol... good work.
1) Verizon Galaxy Nexus | ROM: cMetal 4.4.1
2) Google Nexus One | ROM: Enom Official 1.9.1 / FroYo 2.2 Leak | Radio: Stock
3) T-Mobile HTC HD2 (HTC Leo1024) | ROM: Energy 21903 Sense 2.5+Co0kieHT | SPL: 2.08HSPL | Radio: Stock
4) T-Mobile G1 (HTC Dream) switchROM.sh: XROM v2.X/JACXHEROSKI 1.8 custom/Cyanogen v4.X.X | SPL: Haykuro's 1.33.2005 | Radio: 2.22.19.26I

Quote:
Originally Posted by empty-ness View Post
I rooted the nexus one... and since then the phone wont open beyond the G1 logo
 
dumfuq
Old
#4  
Retired Recognized Developer - OP
Thanks Meter 43
Posts: 542
Join Date: May 2009
just posted bart-0.9.1. Fixes a bug where old nandroid backups are retained when same rom name is used.
 
overground
Old
#5  
overground's Avatar
Moderator & Developer Committee / Recognized Developer - xxxda-developers Founder
Thanks Meter 1165
Posts: 5,235
Join Date: Apr 2009
Location: Oxnard, CA Likes: Los Angeles Lakers Dislikes: Heavy petting zoos
IDK why, but removing the last * in the following command seemed to work better (got an error including the last *).

Code:
mkdir /sdcard/bart
mv /sdcard/switchROM/* /sdcard/bart/
 
T-mobile SDA, T-mobile G1 (bronze) Rooted, Nexus One Rooted 4.0.4, T-mobile G2x Rooted, Viewsonic G-tab 10.1", HTC OneX (SOLD), Kindle Fire Rooted, T-mobile SGS3 rooted, Note 10.1 rooted / GDE=360s of fun!! / pinkventure.com
Quote:
Originally Posted by dumfuq View Post
That is correct. Or you cold use the escape sequence instead of quotes.
Code:
sh /system/sd/bart.sh Double\ post -d -u -m -f -u -q knockeduphooker9.1.1Full10-26-09
Buy me some meds
 
dumfuq
Old
#6  
Retired Recognized Developer - OP
Thanks Meter 43
Posts: 542
Join Date: May 2009
Quote:
Originally Posted by overground View Post
IDK why, but removing the last * in the following command seemed to work better (got an error including the last *).

Code:
mkdir /sdcard/bart
mv /sdcard/switchROM/* /sdcard/bart/

My bad. Thanks.
 
ESKIMOn00b
Old
#7  
Senior Member
Thanks Meter 7
Posts: 411
Join Date: Apr 2009
Location: alabama
Quote:
Originally Posted by dumfuq View Post
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
T-MO MT4G:
perm rooted/S=off
ROM: Iced Glacier
Clockwork Recovery
1.7Ghz!!!

HTC Nexus 1:
ROM: CM/MIUI
Clockwork Recovery

T-mobile G1 Black x2 +1 white (warrantied out waaaay to many times)
ROM: CM6
Spechullll SPL/RA-Recovery
*used for PSFreedom/XBMC remotes*
 
dumfuq
Old
#8  
Retired Recognized Developer - OP
Thanks Meter 43
Posts: 542
Join Date: May 2009
Quote:
Originally Posted by ESKIMOn00b View Post
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).
 
rondey-
Old
#9  
Senior Member
Thanks Meter 0
Posts: 123
Join Date: Mar 2009
Location: Fort Worth
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?
 
dumfuq
Old
#10  
Retired Recognized Developer - OP
Thanks Meter 43
Posts: 542
Join Date: May 2009
Quote:
Originally Posted by rondey- View Post
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.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Immersive Mode on Unrooted Devices with GMD Full Screen Immersive Mode

Everyone likes screen real estate–no question about that. The … more

Android Wear App Review: EchoWear Song Search – XDA Developer TV

Yesterday on XDA Developer TV, Producer AdamOutler tore down a Samsung … more

Blast Those Flags with Knock the Flags

Lately, we have seen a rather drastic shift in the world of mobile device gaming. The infamous Angry … more