Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,772,327 Members 44,944 Now Online
XDA Developers Android and Mobile Development Forum

[CWM UTIL] GS2PreloadBackup/Restore scripts for Samsung JB (02/03/2013)

Tip us?
 
hawkerpaul
Old
(Last edited by hawkerpaul; 17th July 2013 at 08:19 AM.)
#1  
hawkerpaul's Avatar
Recognized Contributor - OP
Thanks Meter 5441
Posts: 2,468
Join Date: Sep 2011
Location: UK

 
DONATE TO ME
Default [CWM UTIL] GS2PreloadBackup/Restore scripts for Samsung JB (02/03/2013)

The JB XXLSJ leak and the latest XWLS8 official JB releases have introduced a new partition on /dev/block/mmcblk0p12 mounted to /preload.
This was required due to the fact that the /system partition just isn't big enough to hold all the extra apps the JB leak requires.
The problem with this is that with the exception of PhilZ Kernel and Jeboo, CWM backups in bith Siyah and DorimanX omit the backing up this /preload partition. If you regularly try out different ROMs and restore back, this can mean your ROM's getting a little out of step as it would have the /preload files from the ROM you last flashed, with all other files coming from the ROM you performed the backup on.

Currently, if you are on Siyah/Dori, the only way to backup/restore everything via CWM backups is to:
a) reboot into recovery
b) flash PhilZ/Jeboo
c) go to advanced>reboot recovery
d) make your backup in PhilZ/Jeboo/Apolo recovery
and if you want to revert back to Siyah/Dori:
e) flash Siyah/Dori
f) advanced>reboot recovery

If you ever need to restore, and you are using Siyah/Dori then you will need to:
a) reboot into recovery
b) flash PhilZ/Jeboo
c) go to advanced>reboot recovery
d) restore your backup in PhilZ/Jeboo/Apolo recovery
e) flash Siyah/Dori
f) reboot

NOTE: Later versions of PhilZ require you to specifically set the backup/restore of /preload. This is done in PhilZ CWM Recovery:
1. boot into PhilZ recovery
2. Philz settings
3. Special backup and restore
4. Misc nandroid settings
5. Toggle /preload processing (make sure this says /preload will be processed)


To get around this current omission in Siyah and Dori, I have written the following 2 CWM flashable zips:
GS2PreloadBackup
This will backup your current /preload partition.
The backup is made on a per-ROM basis to /sdcard/MyBackups/preload/[ROM-Name]/preload.tar. Therefore, if you backup on several different ROMs, you will get several ROM folders in this preload backup location, one backup per ROM
GS2PreloadRestore
This will restore the /preload backup made by the above script for your current ROM.
So if you are on Siyah/Dori and want to make a full backup without flashing between PhilZ, you can now do the following:
1. Boot up into recovery
2. Make your CWM backup
3. Run GS2PreloadBackup.zip

Further down the line, if you ever wanted to restore this, then
1. Boot up into recovery
2. Restore your CWM backup
3. Flash GS2PreloadRestore.zip

The restore is sensitive to the ROM you are currently on, so it will only restore the /preload for you current ROM, provided you have run the backup script previously for the ROM of course.


Changing the backup location
By default, backups are made to the internal SD card in /sdcard/MyBackups as described above. You can change the backup location to the external SD card if required. This can be done by editing /sdcard/MyBackups/HawkerOptions/MyWipeOptions.prop. Within this file there is a line that tells the script where the backups are to be stored. Edit the following line as required:
BKP_LOCATION=int (backs up to INTERNAL SD Card, ie. /sdcard/MyBackups)
BKP_LOCATION=ext (backs up to EXTERNAL SD Card, ie. /storage/extSdCard/MyBackups)

Please note, that if you change the location between int/ext in MyWipeOptions.prop, your backups will not get automatically moved to the new location. You would have to manually move the current backup over to the new location if you do not want to potentially have two copies of the backups.


Test Mode
The script inside the zip file that does all the work is called GS2Hawker.sh. This can be called via adb shell/Script Manager etc. in order to perform a test dummy-run. The Test Mode goes through all the motions as per a standard CWM Recovery run, but it does not remove any files/folders in any way, and merely shows the commands it would have done.
eg. extract GS2Hawker.sh from the zip using 7Zip or similar
adb shell
sh GS2Hawker.sh PreloadBackup
sh GS2Hawker.sh PreloadRestore


Summary of Files Created/Used
1. /sdcard/MyBackups/HawkerLogs/GS2PreloadBackup.log.
2. /sdcard/MyBackups/HawkerLogs/GS2PreloadRestore.log.
These shows the activity log of what the script has done. This gets overwritten the next time you run the script.
3. /sdcard/MyBackups/HawkerOptions/MyWipeOptions.prop. Options file for all my scripts. Currently this contains the option for backup location, internal or external SD card. (See Changing the backup location above)


These scripts are of course only a temporary measure as I am in no doubt that both Siyah and Dori will both also include the /preload partition in their CWM Recovery scripts very shortly, but for now, I hope this might help one or two of you out.


Known Issues
Free space checking prior to performing the backup always returns free space on internal sdcard even when
backing up to external sd card.

For some reason, when I do a df (on Siyah, not sure about other kernels)
I get the following:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mmcblk0p11
12063840 231264 11832576 2% /mnt/.secondrom
/dev/block/mmcblk1p1 12063840 231264 11832576 2% /sdcard
/dev/block/mmcblk0p11
12063840 231264 11832576 2% /sdcard
/dev/block/mmcblk1p1 30648992 17592608 13056384 57% /emmc

It appears /dev/block/mmcblk1p1 is mounted to /emmc AND /sdcard?????!!!!
All file operations on /emmc gets performed on the extenral sd card as expected (ie your backups WILL go to external), BUT when the df command is issued to check for available space, it is performed on /sdcard! Therefore, if the script is trying to find the space left on /emmc, and the device returned from the df command is /sdcard, then an error is presumed, an no space check performed.


Please Note
I use these scripts myself between many flashes of different ROMS, and are provided here, as-is, out of my passion for development. Although every effort has been made to ensure everything works correctly on my handset I cannot be held responsible if things get messed up, or if you put something in your user-definable files that you shouldn't have included. As with everything else on here, you flash anything at your own risk. I always recommend performing a full CWM backup before attempting to flash anything onto your device.
Device: Samsung GT-I9505
My Scripts
My Web Site
The Following 49 Users Say Thank You to hawkerpaul For This Useful Post: [ Click to Expand ]
 
hawkerpaul
Old
(Last edited by hawkerpaul; 19th June 2013 at 10:59 PM.)
#2  
hawkerpaul's Avatar
Recognized Contributor - OP
Thanks Meter 5441
Posts: 2,468
Join Date: Sep 2011
Location: UK

 
DONATE TO ME
Current Versions
GS2PreloadBackup 1.05 (22/05/2013)
GS2PreloadRestore 1.05 (02/03/2013)
Note: If the latest versions quoted above do not appear in the download devhost site, then please be patient!
ApriliaM3 should soon be uploading them.


Downoad Here

Download Here


My HUGE thanks goes out to ApriliaM3 for hosting the scripts.
Please give him the thanks he deserves.

To Do
....
Work in Progress
....
Changelog
GS2PreloadBackup v1.05 (22/05/2013)
1. Extra free space checking. (See OP for known issues)

GS2PreloadBackup v1.04 GS2PreloadRestore v1.05 (02/03/2013)
1. Backups can now go to either internal or external SD Card. See Post #1 for details

GS2PreloadRestore v1.04 (22/02/2013)
1. Now restores /preload/symlink instead of whole of /preload for greater flexibility in dual-boot systems
2. Current /preload/symlink contents removed before restore giving a better snapshot for the restore point

GS2PreloadBackup v1.03 (22/02/2013)
1. Now backs up /preload/symlink instead of whole of /preload

GS2PreloadRestore v1.03 (22/02/2013)
1. Current /preload contents removed before restore giving a better snapshot for the restore point
2. Progress now given in Mb during the restore process

v1.02 (13/02/2013)
1. Numerous display updates
2. Log file now goes to /sdcard/MyBackups/HawkerLogs so that they are grouped with logs from my other scripts

v1.01 (31/01/2013)
1. Progress now given during backup operation of the size of backup complete
Device: Samsung GT-I9505
My Scripts
My Web Site
The Following 16 Users Say Thank You to hawkerpaul For This Useful Post: [ Click to Expand ]
 
THE RED BLUR
Old
(Last edited by THE RED BLUR; 15th January 2013 at 03:22 PM.)
#3  
THE RED BLUR's Avatar
Senior Member
Thanks Meter 23094
Posts: 6,981
Join Date: Mar 2012
Location: LONDON
Thanks buddy:thumbup::thumbup:. I just wanted to get in first. :thumbup::thumbup:

Edit. I just ran a backup and it worked and so did the restore :thumbup:

In the meantime I'll leave this picture until I can post something constructive.



SIGNATURE
 


PHONE : SGSII
Sent via: Tapatalk 2
Main ROM: Alliance rom v5.2

KERNEL : Dorimanx 7.39
(DEFAULT PROFILE AND SETTINGS )
MODEM : BVLP7
BATTERY : Stock 1650mAh
EXTERNAL Sdcard : Samsung Class 10 32gb
LAUNCHER : Apex

My Guides list to install NeatRom and other ROMS and kernels on LSJ + tools to have a bug free rom + how to back up and RESTORE FOM FULLY = http://forum.xda-developers.com/show...php?p=35923600

1.Rom Nuke script

http://forum.xda-developers.com/show...php?p=36268094

2.Kernel Clean script

http://forum.xda-developers.com/show...php?p=34879811

3.Fast Dormancy :

http://forum.xda-developers.com/show...php?p=36396636

4. How to install full wipe with rom nuke on LSJ

http://forum.xda-developers.com/show...php?p=36655790

*Disclaimer[/B] = My most up to date info in Tapatalk or xda apps.


MY CAVE OF GUIDES ON FLASHING AND USING Stock 4.1.2 ROMS AND KERNALS + BONUS TOOLS
http://forum.xda-developers.com/showpost.php?p=35923600
The Following 10 Users Say Thank You to THE RED BLUR For This Useful Post: [ Click to Expand ]
 
Nos_20
Old
(Last edited by Nos_20; 14th January 2013 at 07:55 PM.)
#5  
Nos_20's Avatar
Senior Member
Thanks Meter 1095
Posts: 1,794
Join Date: Sep 2011
Location: SGSII Heaven
Thanks Hawker, great work.

Red you got a nice ass!

Edit. ... I have done a backup and ran the zip after it and it worked great.

Thank you!

Sent From My Galaxy S2 Running
AllianceROM Powered By DorimanX Kernel
The Following 3 Users Say Thank You to Nos_20 For This Useful Post: [ Click to Expand ]
 
ApriliaM3
Old
(Last edited by ApriliaM3; 15th January 2013 at 02:47 AM.)
#6  
ApriliaM3's Avatar
RC-RT Committee / Senior Moderator
Thanks Meter 13589
Posts: 5,959
Join Date: Feb 2012
Location: Songkhla
Some more great work and another great guide there Paul... well done!
I have now created a directory for your work on my Dev-Host mirror site HERE

The Following 6 Users Say Thank You to ApriliaM3 For This Useful Post: [ Click to Expand ]
 
hawkerpaul
Old
#7  
hawkerpaul's Avatar
Recognized Contributor - OP
Thanks Meter 5441
Posts: 2,468
Join Date: Sep 2011
Location: UK

 
DONATE TO ME
Quote:
Originally Posted by ApriliaM3 View Post
Some more great work and another great guide there Paul... well done!
I have now created a directory for your work on my Dev-Host mirror site HERE
Thanks Pete.
I've updated the links in the OP to yours.

I'll let you know if I update the scripts at all.

Cheers mate!
Device: Samsung GT-I9505
My Scripts
My Web Site
 
Maw2607
Old
#8  
Maw2607's Avatar
Senior Member
Thanks Meter 211
Posts: 170
Join Date: Dec 2007

 
DONATE TO ME
Thank you, really usefull script.
 
naluca
Old
(Last edited by naluca; 26th January 2013 at 01:55 PM.)
#9  
Member
Thanks Meter 26
Posts: 62
Join Date: Sep 2012
Location: Bucharest
deleted
 
hawkerpaul
Old
(Last edited by hawkerpaul; 1st February 2013 at 07:55 AM.)
#10  
hawkerpaul's Avatar
Recognized Contributor - OP
Thanks Meter 5441
Posts: 2,468
Join Date: Sep 2011
Location: UK

 
DONATE TO ME
Updated to V1.01

See Changelog for details
Device: Samsung GT-I9505
My Scripts
My Web Site

The Following 3 Users Say Thank You to hawkerpaul For This Useful Post: [ Click to Expand ]
Tags
hawker's threads
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes