[v8.10] Online Nandroid / Nandroid Backup without re-booting [CWM + TWRP + 4EXT]
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
and NOT on-android
Online Nandroid backups the below partitions to /sdcard/clockworkmod/backup
- mmcblk0_start (for Acer devices)
- wimax (for Samsung devices)
- appslog (for HTC and Sony (Ericsson) devices)
- datadata (for Samsung devices)
- efs (for Samsung devices)
- preload (for Samsung devices)
- .cust_backup (for Huawei devices)
- flexrom (for Acer devices)
- (cp)uid (for Acer devices)
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
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
1. Download and copy zip file to SD card
2. Reboot into recovery
3. Choose install zip from SD card, select zip and flash
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.
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:
Custom Backup Name:
onandroid -c NAME
onandroid --custom NAME
* Please be careful not to include characters not allowed in filenames.
* Example: Use phone timezone for backup file name
* Example: Use UTC (default) for backup file name
* Note: UTC is used as default (if no timezone modifier is passed). This is to comply with CWM nandroid backups.
* Good old backup mode (default).
* Note: This is the most commonly known, default backup format.
* Split backup mode (CWM6+ only).
* 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.
* Garbage collect. For incremental backups (used for cleanup after deleting incremental backups).
* Advanced / Selective backup mode. For backing up only specific partitions.
onandroid -a PARTITIONS
onandroid --advanced PARTITIONS
* Partition letters / names can be found by typing onandroid -ah
* TWRP backup mode.
* By default, TWRP backup mode creates compressed backups. If uncompressed backups are required, use it like this:
onandroid -w -cd
onandroid --twrp --compression-disable
* By default, TWRP backup mode generates md5sum. If md5sums are not required, use it like this:
Replace Older Backups (with same name) - used with custom backup names:
onandroid -w -md
onandroid --twrp --md5-disable
* 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.
onandroid -c MyBackup -r
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.
Issue Tracker: http://bit.ly/OnlineNandroid-issues
Older Versions: http://bit.ly/OnlineNandroid-downloads
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.