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

Search This thread

hawkerpaul

Senior Member
Sep 25, 2011
3,305
6,242
UK
www.practicenet.co.uk
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. :)
 
Last edited:

hawkerpaul

Senior Member
Sep 25, 2011
3,305
6,242
UK
www.practicenet.co.uk
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
 
Last edited:

THE RED BLUR

Senior Member
Mar 7, 2012
6,995
21,770
LONDON
Thanks buddy:thumbup::thumbup:. I just wanted to get in first. :D: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. ;)

peneju4e.jpg


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://xdaforums.com/showthread.php?p=35923600

1.Rom Nuke script

http://xdaforums.com/showthread.php?p=36268094

2.Kernel Clean script

http://xdaforums.com/showthread.php?p=34879811

3.Fast Dormancy :

http://xdaforums.com/showthread.php?p=36396636

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

http://xdaforums.com/showthread.php?p=36655790

 
Last edited:

kantjer

Inactive Recognized Contributor
Dec 11, 2010
12,393
29,850
www.androidfilehost.com
Updated to V1.01

See Changelog for details
I have been trying to backup preload to my external sd card by modifying /sdcard/MyBackups/MyBakDevice.txt ( see screenshot)

2013-02-01%2015.29.55.png


But the backup is stil made on the internal and after every attempt the content of MyBakDevice.txt is set back to the default /sdcard
I'm I doing something wrong here :confused:

EDIT: Tried 3 times, same result every time.
 
Last edited:
  • Like
Reactions: THE RED BLUR

hawkerpaul

Senior Member
Sep 25, 2011
3,305
6,242
UK
www.practicenet.co.uk
Backup to external sd card not possible currently, so I'm looking into getting this working properly. For now, ignore any information relating to MyBakDevice.txt. All backup will go to internal sd card only for the time being.
 
Last edited:
  • Like
Reactions: kantjer

ohwarumbloss

Senior Member
Oct 9, 2010
1,169
805
Kalletal
AW: [CWM UTIL] GS2PreloadBackup/Restore scripts for Samsung JB (22/02/2013)

This is awesome, thanks for your work!!!!!
May I ask something? (if not, ignore me)
Is it possible to not backup the full /preload partition but only the /preload/symlink part of it? I ask because it would be very helpful with this : http://xdaforums.com/showthread.php?p=38209559
So, a user could backup /preload/symlink/... Then install a 2nd Rom, that will probably format /preload and just restore it easily with your File. This might be a very big step for Dual boot as it makes so many things easier!
Anyways, thank you very much for your efforts!!!
Greetings
Thomas

Sent from my GT-I9100 using xda app-developers app
 

ohwarumbloss

Senior Member
Oct 9, 2010
1,169
805
Kalletal
AW: [CWM UTIL] GS2PreloadBackup/Restore scripts for Samsung JB (22/02/2013)

As far as I'm aware, apart from the generic lost+found folder linux creates under each partition (which 99% of the time will be empty) the only contents of the /preload partition IS the symlink folder.

Thanks!
But in my /preload there is the /symlink part of my Sammy Rom (shorted to about 80mb) and the /system of 2nd Rom (MCM's 10.1)
The created Backup with your zip is about 390mb big so I figured that there has to be more than just the symlink stuff.
This could be solved, of course by a clean install of first Rom (Sammy), backup with your file, install 2nd Rom and then restore /preload.
But it would be easier if only /preload/symlink would be backed up and later restored.
But, important, I don't want to bug you, it's awesome as it is, seriously!!
Greetings
Thomas

Sent from my GT-I9100 using xda app-developers app
 
  • Like
Reactions: hawkerpaul

ohwarumbloss

Senior Member
Oct 9, 2010
1,169
805
Kalletal
AW: [CWM UTIL] GS2PreloadBackup/Restore scripts for Samsung JB (22/02/2013)

Ok mate, I'll have a look into it for you.

Edit:
Updated to GS2PreloadBackup v1.03 and GS2PreloadRestore V1.04

See post #2 for details

Awesome, thank you very much!!!
If it's ok I will add a how-to to my thread and link to yours?
To me, this is an enormous step forward :) great!!

Sent from my GT-I9100 using xda app-developers app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 48
    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. :)
    16
    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
    10
    Thanks buddy:thumbup::thumbup:. I just wanted to get in first. :D: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. ;)

    peneju4e.jpg


    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://xdaforums.com/showthread.php?p=35923600

    1.Rom Nuke script

    http://xdaforums.com/showthread.php?p=36268094

    2.Kernel Clean script

    http://xdaforums.com/showthread.php?p=34879811

    3.Fast Dormancy :

    http://xdaforums.com/showthread.php?p=36396636

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

    http://xdaforums.com/showthread.php?p=36655790

    7
    Updated GS2PreloadBackup to v1.04 and GS2PreloadRestore to v1.05

    See post #2 for details
    6
    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 :)