Post Reply

[v9.51] Online Nandroid / Nandroid Backup without re-booting [CWM + TWRP + 4EXT]

OP ameer1234567890

26th April 2012, 07:14 AM   |  #1  
ameer1234567890's Avatar
OP Recognized Developer
Flag Thulhaadhoo
Thanks Meter: 1,756
 
1,615 posts
Join Date:Joined: Mar 2012
More
Nandroid backups are usually performed in recovery mode. This means you would have to turn off your phone and reboot in recovery mode, which wastes a whole lot of time rebooting and a lot more time offline. For me, this has been a killer as I do regular nandroid backups. Having to reboot in recovery and finding missed calls, sms from my wife and friends is totally not accepatable for me. So, I set to develop an online nandroid backup tool, namely Online Nandroid, which can do nandroid backups without switching off my phone.

Today, I am releasing it to public, as it may serve good for some others too. Originally I developed Online Nandroid specifically for Xperia devices, but now I am releasing it for all android devices.

This tool, eventhough called "Online Nandroid", does not upload/save backups to any online/cloud services. Online here means that it does backup while phone is live or still running Android.

The short name onandroid is meant to be pronouced as o-nandroid or o'nandroid and NOT on-android.




Online Nandroid backups the below partitions to /sdcard/clockworkmod/backup directory.
  • mmcblk0_start (for Acer devices)
  • uboot (for MTK based devices)
  • boot
  • recovery
  • wimax (for Samsung devices)
  • appslog (for HTC and Sony (Ericsson) devices)
  • kernel
  • system
  • data
  • cache
  • datadata (for Samsung devices)
  • efs (for Samsung devices)
  • preload (for Samsung devices)
  • .cust_backup (for Huawei devices)
  • flexrom (for Acer devices)
  • custpack (for Alcatel devices)
  • mobile_info (for Alcatel devices)
  • boot (for HP Touchpad)
  • .android_secure
  • sd-ext
The date format used for folder name is the same used by CWM itself and nandroid backups created with Online Nandroid can safely be restored using CWM, TWRP and 4EXT recoveries.

Feedback (especially ideas to improve) are most welcome.

Official List of Supported Devices: http://bit.ly/OnlineNandroid-SupportedDevices

Requirements:
1. Rooted android phone
2. A terminal emulator installed on phone
3. Latest version of Busybox
4. A working CWM, TWRP or 4EXT based recovery installed
5. Some patience

Installation:
1. Download and copy zip file to SD card
2. Reboot into recovery
3. Choose install zip from SD card, select zip and flash
4. Reboot

Usage:
1. Open terminal emulator
2. Type su to obtain root
3. Type onandroid
4. Wait and watch


  • If you are getting error mkyaffs2image not found in path, try fix tool in this post.
  • .
  • If you are getting error dedupe not found in path, try dedupe tool in this post.
  • .
  • If Online Nandroid is failing to find boot and recovery partitions, flash the zip file for your device from here. If your device is not on the list, post a comment there or post a reply in this thread with your device model.
  • If you have a Motorola RAZR i and are unable to flash the provided zip files, visit this thread and get zip files specific for your device.


The behaviour of Online Nandroid can be adjusted by using command line flags, some of which are described in detail below. Each command line flag has its longer counter-part and both forms can be mixed. For a complete list of command line flags and short descriptions, you can type:
Code:
onandroid -h
OR
onandroid --help
Custom Backup Name:
* Example:
Code:
onandroid -c NAME
OR
onandroid --custom NAME
* Please be careful not to include characters not allowed in filenames.


Timezone modifier:
* Example: Use phone timezone for backup file name
Code:
onandroid -p
OR
onandroid --phone
* Example: Use UTC (default) for backup file name
Code:
onandroid -u
OR
onandroid --utc
* Note: UTC is used as default (if no timezone modifier is passed). This is to comply with CWM nandroid backups.


Backup Modes:
* Good old backup mode (default).
* Example:
Code:
onandroid -o
OR
onandroid --old
* Note: This is the most commonly known, default backup format.

* Split backup mode (CWM6+ only).
* Example:
Code:
onandroid -l
OR
onandroid --split
* Note: This is specifically useful if you have partitions which are over 2GB in size. Use this only if you have CWM 6+.

* CWM6 style incremental / dedupe backup mode.
* Example:
Code:
onandroid -i
OR
onandroid --incremental
* Garbage collect. For incremental backups (used for cleanup after deleting incremental backups).
* Example:
Code:
onandroid -gc
OR
onandroid --garbage-collect
* Advanced / Selective backup mode. For backing up only specific partitions.
* Example:
Code:
onandroid -a PARTITIONS
OR
onandroid --advanced PARTITIONS
* Partition letters / names can be found by typing onandroid -ah

* TWRP backup mode.
* Example:
Code:
onandroid -w
OR
onandroid --twrp
* By default, TWRP backup mode creates uncompressed backups. If compressed backups are required, use it like this:
Code:
onandroid -w -ce
OR
onandroid --twrp --compression-enable
* By default, TWRP backup mode generates md5sum. If md5sums are not required, use it like this:
Code:
onandroid -w -md
OR
onandroid --twrp --md5-disable
Replace Older Backups (with same name) - used with custom backup names:
* While using custom backup names, Online Nandroid will not allow an already existing backup name to be specified, by default. Trying this will return an error and halt backup. If you want to replace the older backup with a new backup, by using the same custom backup name, you can specify the below command line flag.
* Example:
Code:
onandroid -c MyBackup -r
OR
onandroid --custom MyBackup --replace
* Note: This will only work with custom backup names. This can be used to update a backup from a previous state, by way of using advanced backup mode in combination with this mode.

Change Log:
Code:
v1.0  - Initial release.
v1.1  - Bug Fix: incorrect implementation of help command.
v1.2  - Bug Fix: changed script permissions from 777 to 755
        Improvement: changed elapsed display of seconds only to minutes & seconds.
v1.3  - Bug Fix: error if /sbin/sh is not present.
v2.0  - Fixed: various bugs and re-organized script.
        Added: timezone modifier.
        Improved: usage instructions screen.
        Added: su detection.
v2.1  - Bug Fix: .android_secure partition not being backed-up correctly.
v2.2  - Bug Fix: size calculation of .android_secure partition.
v2.3  - Improvement: size calculation in .android_secure partition.
v3.0  - Bug Fix: unknown uid 0 (incorrect detection of root).
        Added: sd-ext backup.
        Added: battery level check.
        Added: SD card check.
        Improved: .android_secure backup.
        Fixed: various bugs and re-organized script.
v3.1  - Bug Fix: SD card not found error on some devices.
        Re-organization of script and removal of bloat code.
v3.2  - Bug Fix: Incorrect detection of root.
        Added: New logging mechanism.
v3.3  - Bug Fix: Incorrect sdcard mounting.
        Bug Fix: Various fixes for busybox conflicts.
        Improvement: Logging mechanism.
v3.4  - Bug Fix: Empty md5sum.
        Bug Fix: Size calculation of sdcard.
        Bug Fix: Script exiting before sd-ext and .android_secure partitions backed-up.
v3.5  - Bug Fix: Busyboxed 'which' command.
        Removed some log lines for cleaning-up.
v3.6  - Removed: mount format detection bloat due to non-busyboxed version.
v3.7  - Busyboxed "cat" commands.
        Added: Battery level detection for Xperia X10.
        Re-positioned root detection.
v4.0  - Added: LED and vibrate notification on backup completion.
        Bug Fix: Minor bug in "tar" detection.
        Bug Fix: Cannot create log file.
v4.1  - Bug Fix: Corrected size checking of .android_secure partition.
v4.2  - Added: md5sum verification.
        Improved: md5sum generation.
v5.0  - Added: Backup of boot, recovery, wimax and appslog partitions.
        Added: Proper sdcard detection.
        Added: Detailed error logging.
        Added: Cleaning-up temp mounts upon exits.
        Added: LED notification for Xperia U.
        Added: Version number to log.
        Added: ext2/3/4 and rfs file system support.
        Added: Avoid mkyaffs2image detection if device does not have a yaffs2 partition.
        Added: Force remounting and unmounting.
        Added: system, data, cache, datadata and .android_secure partition detection.
        Improved: sd-ext detection.
        Improved: sd-ext backup.
        Improved: md5sum generation and validation.
        Improved: sd-ext detection.
        Improved: Usage instructions screen.
        Improved: Battery level detection.
        Improved: LED and vibrate notification.
        Increased safety space from 7MB to 10MB.
        Code clean-up and re-organization.
v5.1  - Bug Fix: Minor bug in sd card detection when device has internal storage and an external sd card mounted.
        Bug Fix: Bug in .android_secure backup.
v5.2  - Bug Fix: SD Card detection in Jellybean devices.
        Bug Fix: boot partition detection in devices with sboot partition.
        Added: /efs partition backup (for Samsung devices).
        Increased: Safety size from 10 to 12.
v5.3  - Added: Partition detection via part_detect_tool.
        Bug Fix: boot, recovery, wimax and appslog partition backup for non-mtd devices.
        Bug Fix: boot, recovery, wimax and appslog partition detection (Exact partition names).
        Improvement: Busyboxed some cut and grep commands.
        Removed: Some unwanted code in partition detection.
v5.4  - Bug Fix: Error logging of partition layout.
        Bug Fix: sd-ext detection bug.
        Improvement: Logging of required space.
v5.5  - Bug Fix: SD Card detection.
        Bug Fix: sd-ext detection.
        Bug Fix: sd-ext backup method.
        Bug Fix: boot, recovery, wimax and appslog partition size calculation.
        Bug Fix: socket ignored error by tar.
        Bug Fix: /data/media included in /data partition backup.
        Bug Fix: sd-ext included in /data partition backup for app2sd, link2sd, etc... setups.
        Bug Fix: Eliminate /data/media while calculating used size of /data partition.
v5.6  - Bug Fix: basename error on some devices.
        Bug Fix: md5sum spitting an error if .android_secure not backed-up.
        Bug Fix: Fixed regression bug in sd card and sd-ext detection.
v5.7  - Bug Fix: partition detection.
        Bug Fix: sd card space calculation on some devices.
        Improvement: some busyboxing.
v5.75 - Bug Fix: partition detection. (bug introduced in v5.7)
v5.8  - Bug Fix: partition detection.
v5.9  - Added: /.cust_backup partition backup (for Huawei devices).
        Bug Fix: Partition detection.
        Bug Fix: Include sd-ext folder in data partition while skipping it's contents.
v6.00 - Added: CWM 6 style incremental backups.
        Added: Garbage cleaning for incremental backups.
        Added: Advanced backup / Selective backup.
        Added: Long arguments for timezone.
        Added: Setting alternate storage media via command line flag.
        Added: Setting sd-ext path via command line flag.
        Added: Battery level checking for HTC One X.
        Added: Split backup mode (CWM 6+ only).
        Added: Backup mode detection via .default_backup_format file (used by CWM).
        Added: Advanced backup mode detection via .advanced_backup_partitions file.
        Added: /flexrom and mmcblk0_start partitions backup (for Acer devices).
        Added: Revamped and more useful progress indicators.
        Added: Na Rnfgre Rtt.
        Added: Replacing named backups with command line flag.
        Added: Disabling notifications with command line flag.
        Added: Setting progress indicator type with command line flags.
        Added: Trapping exit/kill signals and cleaning up before exiting.
        Added: Prompt whether to replace if backup name exists.
        Added: BusyBox version checking.
        Removed: Partition skip messages for device specific partitions.
        Removed: Safety pin size adjustment.
        Improved: Size calculation of /data partition if /data/media exists.
        Improved: Battery level checking.
        Improved: Code used for processing arguments.
        Improved: .android_secure detection.
        Improved: .android_secure size calculation.
        Improved: Help screens.
        Improved: Detection and backup of /.cust_backup partition.
        Improved: Size calculation in all partitions.
        Improved: SD Card detection and automatic selection of external SD Card.
        Improved: Logging in log file.
        Improved: Some more busyboxing.
        Changed: Argument for setting timezone. (-p for phone timezone instead of -h)
        Changed: Minor version numbers to 2 digits.
        Re-organisation of code.
v6.01 - Bug Fix: sdcard detection in some devices using native app2sd.
v6.10 - Bug Fix: Actually fixed the bug mentioned in v6.01 changelog.
        Added: HP Touchpad boot partition backup. (Partition letter p)
        Bug Fix: mkyaffs2image requirement detection
        BugFix: Removed disk dump of boot partition for Acer devices and HP Touchpad.
v6.11 - Bug Fix: Filesystem detection in data partition for incremental backups.
        Bug Fix: wrong partition detected as sd-ext in some devices.
v6.12 - Bug Fix: filesystem detection in data partition on some devices.
v6.13 - Bug Fix: .android_secure detection when an alternate storage media is selected.
        Bug Fix: Remount error in AROMA terminal.
        Bug Fix: Avoid clearing log file while checking the version number only.
v6.14 - Bug Fix: Busyboxed ls command in md5 verification.
        Bug Fix: Added some detailed error logging for could not change to path errors.
        Bug Fix: Could not change to path errors.
v7.00 - Added: TWRP support.
        Added: Specific exit codes for exits upon an error.
        Added: Device details to log file.
        Added: Output PID to onandroid.pid file upon each run.
        Added: /preload partition backup. (Partition letter "o".)
        Added: Flag to backup yaffs2 partitions as tar archives.
        Added: Notice to install patch file, if boot partition was not found.
        Removed: cpuid backup on Acer devices, since it freezes on some ROMs.
        Removed: sd-ext not found message. Not all devices have one.
        Removed: .android_secure not found message. Not all devices have one.
        Improved: More elegant backup process.
        Improved: Some internal variable naming.
        Bug Fix: Notification disable did not work in some devices.
        Bug Fix: Busyboxing of some commands.
        Bug Fix: Minor bug in error logging.
v7.01 - Bug Fix: Duplicate md5sum generation while using replace mode.
        Removed: A redundent code block.
v7.50 - Added: Copy log file to backup folder at the end of backup.
        Added: Replace the word "date" in backup name with current date.
        Added: Finally busyboxed md5sum dd and tar calls.
        Added: Kill all sub-processes upon exits.
        Added: Ability to backup emmc partitions for MTK based devices.
        Bug Fix: Incomplete backups while using compression (default) in TWRP mode.
        Bug Fix: Partition size detection of emmc partitions.
        Bug Fix: Notification on some devices.
        Bug Fix: sd-ext detection on some devices.
        Bug Fix: Could not change to folder bug in some devices, in TWRP mode.
v7.52 - Bug Fix: Minor mistake in description of nandroid_dd function.
        Bug Fix: Reverted fix in v7.50 for partition size detection of emmc partitions.
v7.53 - Bug Fix: Unknown operand bug in power level detection.
        Bug Fix: Restore not working on some Android 4.2 devices.
        Bug Fix: Progress percentage for split backup mode.
        Bug Fix: Double backup of /data/data directory in TWRP mode.
v8.00 - Added: License to script file.
        Added: Ability to specify path to busybox via command line flag.
        Added: Ability to specify path to busybox via onandroid.busybox file.
        Added: Partition layout detection for MediaTek (MTK) based devices without patch file.
        Added: Proper sd-ext detection if sd-ext is mounted at /data.
        Added: A second help screen with -h2 / --help2 .
        Added: Information to log file about installed recovery.
        Added: /custpack partition backup, for Alcatel devices. (Partition letter "h".)
        Added: /mobile_info partition backup, for Alcatel devices. (Partition letter "i".)
        Added: TWRP setting TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID support.
        Added: TWRP setting TW_FORCE_CPUINFO_FOR_DEVICE_ID support.
        Added: Exclude Google Music cache files.
        Added: Replace the string "romname" in custom backup name, with name of ROM.
        Improved: Excludes detection.
        Improved: Excludes in incremental backup mode.
        Added: TWRP compression using gzip (use -cg flag).
        Bug Fix: Unmounting and removing temporary mounts fail at times.
        Bug Fix: Progress percentage stuck during split backup on some devices.
        Bug Fix: Exit code for busybox not found.
v8.10 - Added: /data/data partition backup (partition letter "j").
        Added: Output which busybox is being used.
        Bug Fix: TWRP default backup name to use hyphen instead of dot.
        Bug Fix: Minor bug in excludes detection.
        Bug Fix: Premature end of backup process.
v8.11 - Bug Fix: The infamous cat write error.
        Bug Fix: Gzip compression not working on some devices.
        Bug Fix: Unknown operand error with some busybox versions.
v8.12 - Bug Fix: Recovery partition backup on HTC One (Sprint).
        Bug Fix: Minor bug in partition size calculation.
v8.20 - Added: Return device ID used by TWRP (-d flag).
        Removed: (cp)uid from list of partitions help screen.
v8.21 - Bug Fix: boot and recovery partition backup on MTD devices.
v8.22 - Bug Fix: SD Card detection on some devices with emulated SD Card.
v9.00 - Added: Option to exclude dalvik-cache from backups (-xd flag).
        Added: AmonRA, 4EXT and Safestrap recovery detection.
        Added: Split TWRP backups larger than 2GB.
        Added: uboot partition backup for some MTK based devices (Partition letter "k").
        Added: Prevent multiple instances of script from running.
        Added: -d / --device-id flag to help screen 2.
        Added: Localization support via external language files.
        Added: boot partition backup on Nook Color (Partition letter "n").
        Added: kernel partition backup (Partition letter "g").
        Changed: onandroid.log file inside backup folder to recovery.log.
        Changed: Made exclusion of Google Music files from backups, optional (-xg flag).
        Changed: Log function to use log applet from toolbox.
        Bug Fix: Specifying partition letter h (for /custpack) brings up help screen.
        Bug Fix: Partition detection on Allwinner devices.
        Bug Fix: Busybox version error did not exit script.
        Bug Fix: .advanced_backup_partitions file not detected at TWRP folder.
        Removed: Command line flag for busybox path, as it cannot be relied upon.
        Improved: Some coding style improvements.
        Improved: Backup replace mode now replaces once all partitions are backed up only.
        Improved: Progress indicators.
v9.10 - Added: Exclude dalvik-cache from sd-ext
        Bug Fix: WRONG_ARGS displayed on help screen.
        Bug Fix: Minor fixes and improvements.
v9.20 - Bug Fix: Multiple instances error with some apps.
        Bug Fix: Wrong sd-ext detection on some devices.
v9.50 - Added: LED notification for Samsung Galaxy Relay 4G.
        Added: Ability to manually specify device ID for TWRP (-ds flag).
        Added: modem partition backup (partition letter q).
        Added: TA partition backup (partition letter v).
        Added: Support for Action CPUs.
        Improved: Space calculation.
        Improved: Merged boot partition letter for different devices.
        Bug Fix: Replace mode deletes old backup if not enough space.
        Bug Fix: Wrong sd-ext detection on some devices.
        Bug Fix: Partition size calculation on emmc devices.
        Bug Fix: Slow file listing in TWRP mode on some devices.
v9.51 - Added: Preservation of SELinux contexts.
        Bug Fix: Data partition size calculated incorrectly when excluding Google Music cache.
        Bug Fix: TWRP backups taking too long for file list.
Twitter: @OnlineNandroid
Source: http://bit.ly/OnlineNandroid
Issue Tracker: http://bit.ly/OnlineNandroid-issues
Older Versions: http://bit.ly/OnlineNandroid-downloads
Attached Thumbnails
Click image for larger version

Name:	screenshot-1343385248234.jpg
Views:	344502
Size:	36.5 KB
ID:	1224849   Click image for larger version

Name:	screenshot-1343385259781.jpg
Views:	219601
Size:	46.0 KB
ID:	1224854  
Attached Files
File Type: zip onandroidv9.10.zip - [Click for QR Code] (139.9 KB, 1242 views)
File Type: zip onandroidv9.20.zip - [Click for QR Code] (140.0 KB, 4156 views)
File Type: zip onandroidv9.50.zip - [Click for QR Code] (139.9 KB, 725 views)
File Type: zip onandroidv9.51.zip - [Click for QR Code] (140.0 KB, 1145 views)
Last edited by ameer1234567890; 22nd July 2014 at 05:19 PM. Reason: New version 9.51 Release
The Following 696 Users Say Thank You to ameer1234567890 For This Useful Post: [ View ]
26th April 2012, 07:20 AM   |  #2  
ameer1234567890's Avatar
OP Recognized Developer
Flag Thulhaadhoo
Thanks Meter: 1,756
 
1,615 posts
Join Date:Joined: Mar 2012
More
Apps / GUIs, Tools, ROMs using Online Nandroid
Apps / GUIs:
Other Tools:
ROMs with Online Nandroid:
Last edited by ameer1234567890; 20th December 2013 at 03:42 PM.
The Following 63 Users Say Thank You to ameer1234567890 For This Useful Post: [ View ]
27th April 2012, 07:19 AM   |  #3  
ameer1234567890's Avatar
OP Recognized Developer
Flag Thulhaadhoo
Thanks Meter: 1,756
 
1,615 posts
Join Date:Joined: Mar 2012
More
For Developers
Moved here: https://github.com/ameer1234567890/O...For-Developers
Last edited by ameer1234567890; 30th December 2012 at 11:25 AM.
The Following 19 Users Say Thank You to ameer1234567890 For This Useful Post: [ View ]
27th April 2012, 07:33 AM   |  #4  
doomed151's Avatar
Senior Member
Thanks Meter: 2,079
 
1,374 posts
Join Date:Joined: Dec 2009
More
I assume that it's not recommended to do other stuff on the phone while it's backing up. Wouldn't a change in /data while backing up corrupt said file?
27th April 2012, 01:28 PM   |  #5  
ameer1234567890's Avatar
OP Recognized Developer
Flag Thulhaadhoo
Thanks Meter: 1,756
 
1,615 posts
Join Date:Joined: Mar 2012
More
Quote:
Originally Posted by doomed151

I assume that it's not recommended to do other stuff on the phone while it's backing up. Wouldn't a change in /data while backing up corrupt said file?

It's always better not to be doing anything else while backup is running. Anyways, the system gets slow while backing up, so you wont be able to do a lot many. I do not think any changed data would corrupt the backup and I have even tried doing some things like texting, calling, playing music, etc while backup is running and it has never given any issues.
The Following 17 Users Say Thank You to ameer1234567890 For This Useful Post: [ View ]
27th April 2012, 04:47 PM   |  #6  
shardul_seth's Avatar
Senior Member
Thanks Meter: 1,705
 
1,096 posts
Join Date:Joined: Jul 2011
Very nice script, I must say

It can easily be converted to an app, the only thing is the backup part has to be done on another thread to prevent ANR errors!
See my USB OTG app (link in signature), it also uses shell commands to do its work
2nd May 2012, 03:38 PM   |  #7  
Senior Member
Thanks Meter: 107
 
392 posts
Join Date:Joined: Jan 2012
More
Hi, thanks for this. Very convenient indeed.
Now I no longer need to reboot in recovery to do a nandroid backup.
Will try restoring from the backuo created.
Thanks again. :cool:

Sent from my MK16i using XDA
8th May 2012, 10:29 AM   |  #8  
ameer1234567890's Avatar
OP Recognized Developer
Flag Thulhaadhoo
Thanks Meter: 1,756
 
1,615 posts
Join Date:Joined: Mar 2012
More
Version 1.2 released!
The Following 6 Users Say Thank You to ameer1234567890 For This Useful Post: [ View ]
8th May 2012, 06:08 PM   |  #9  
kamil004's Avatar
Member
Flag Warszawa
Thanks Meter: 24
 
87 posts
Join Date:Joined: Jun 2009
Donate to Me
More
# onandroid
sh: applet not found

why? file is ok installed but command dont work
Last edited by kamil004; 8th May 2012 at 06:22 PM.
8th May 2012, 10:31 PM   |  #10  
*boy*racer*'s Avatar
Senior Member
Thanks Meter: 410
 
1,248 posts
Join Date:Joined: Jan 2011
Donate to Me
More
How come I keep getting this error? Stock ics xperia ray with sirkays xray kernel.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2012-05-08-22-22-07.jpg
Views:	11220
Size:	35.9 KB
ID:	1049341  
Last edited by *boy*racer*; 8th May 2012 at 10:43 PM.

Post Reply Subscribe to Thread

Tags
backup, nandroid, online
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software Development by ThreadRank