This profile has been created for root users. In particular, those who use a ClockWorkMod (CWM) based recovery to take Nandroid backups. A Nandroid backup is a complete image (or snapshot if you will) of the phone at the time it is taken. When a Nandroid backup is restored, the phone is returned to exactly* as it was when the backup was taken.
* Some elements aren't backed up on all devices, such as the Radio/Modem/Baseband
This profile will Automatically create a Nandroid backup, every Saturday at 04:00 (am). It boots into recovery, takes the backup and then boots back into Android.
This profile has a 2 week backup retention, so you will always have a maximum of 2 backups, the oldest one being deleted before the new one is taken.
You can also add a widget to the homescreen:
Long press home screen > Add Widget > Task > nandroid
This will allow you to take a backup (and reboot automatically) from your homescreen directly. The Schedule will not be overridden, however, the oldest backup will have been replaced.
WARNING - There is no confirmation on this as yet. Pressing it will immediately boot into recovery. I recommend if you can spare a homescreen to this on its own, please do so.
To use this profile, you need to know the mount points on your phone both in android and recovery.
For example, on the s3 there is an internal and an external SD card.
In android (S3) these are:
internal - /mnt/sdcard
external - /mnt/extSdCard
In CWM recovery (S3) these are:
internal - /data/media
external - /external_sd
First you must decide if you are going to use the Internal or External SD card.
On a phone that has NO external sdcard, you would follow the rationale of the S3's internal sdcard (/mnt/sdcard in android).
Similarly if you have a phone that has NO internal sdcard, you would still follow the rationale of the internal sdcard (/mnt/sdcard in android).
Essentially EVERY device will use /mnt/sdcard for their Storage, whether that's an external Micro SD card or Internal SD card. Only devices that have an internal AND external SD card will need to look into that deeper.
People with root explorers can browse to the root of their device, find the /mnt directory and see what everything is mounted as. You will be able to get everything you need to use for the "in Android" settings. As for recovery, this could vary from device to device so if you don't know, ask in the development thread (Probably XDA) of your device's recovery.
Note. Mount points are case sensitive. /mnt/extsdcard will not work if it's supposed to be /mnt/extSdCard
This script by default uses /mnt/sdcard/clockworkmod/backup as the backup location.
This is the Internal SD card for devices that have both an internal AND external SD card.
This is the External SD card for devices that ONLY have an external SD card.
The backup MUST go in the clockworkmod/backup folder because if it does not, your recovery will not be able to restore the backups. It works best on the /mnt/sdcard directory because this is universal for all devices. However, some devices wipe the internal SD when factory resetting from the Android menu (Galaxy S3), so only reset from recovery.
Here is an extract of the script (and what it does):
Code:
# Set today's date
now=$(date +"%d_%m_%y-%H:%M")
# Deletes previous archive (as contained within index1.txt)
rm -rf $(cat /mnt/sdcard/clockworkmod/backup/index1.txt)
# Moves previous backup to archive (index2 becomes index1 for delete next time)
mv /mnt/sdcard/clockworkmod/backup/index2.txt /mnt/sdcard/clockworkmod/backup/index1.txt
# Stamps new index 2
echo '/mnt/sdcard/clockworkmod/backup/'$now > /mnt/sdcard/clockworkmod/backup/index2.txt
# writes a command for recovery to read (creates index2 backup)
echo 'backup_rom("/data/media/clockworkmod/backup/'$now'");' > /cache/recovery/extendedcommand
If you are happy with using the default location of /mnt/sdcard, this script will require minimal modification. Please note that the last command of the script as show below:
Is where the S3's CWM recovery mounts the /mnt/sdcard (as /data/media). This will most likely be different on otehr devices so you need ensure you know your equivelant.
OK, I'll tell you how. Firstly, I will write this as if it was asked by an S3 user because I know the relevant alternative mount points in Android and recovery for this device.
Device(s): Samsung Galaxy S3
Rom: PACman in Black
Kernel: KTZ
Recovery: TWRP
Carrier: Sprint
Thanks: 1,178
Thanked 1,699 Times in 1,181 Posts
Re: [Profile][Root] Auto Nandroid backup
Very nice!
Thanks for this, it'll definitely come in handy
DS
__________________
Has someone helped you? Dont forget to hit the "thanks" button!
Seen an offense or bad post? Hit the /!\ button!
Help support BabyBlues in her walk for breast cancer, click below for more information
D'oh. I forgot to mention it uses secure settings pro, but actually I re-uploaded it because now it doesn't need it. I made as glaring omission from the idea that "reboot recovery" works as a command on android. I feel stupid now.
Last edited by SUroot; January 18th, 2013 at 04:43 PM.
lol i just bought secure settings pro and the profile does not work for me the phone just reboots and goes into recovery but does not do anything after it reboots does not backup anything.
edit:-
i cant download the file i get "Invalid Attachment specified. If you followed a valid link, please notify the administrator"
__________________
Running NeatRom with siyah kernel.
What do you see in recovery? You may see an error? How long is it in recovery? You will see it backing up if its backing up and will be in recovery for a few minutes. The screen should look exactly the same as if manually backing up. You're using Philz?
Disable the reboot into recovery part of the task please then play the task. Then using a root explorer of some kind, go to /cache/recovery and check extendedcommand is present (and its contents)
The updated profile only changes the reboot to recovery action, so it wont fix the issue either, so the issue is something before that.
Just confirmed profile is definitely working for me. Need to see whats different for you. On the GT-i9300 it should work out of the box, with no additional config or manipulation
my phone reboots into recovery and just stays on the main recovery screen(like it would if u boot into recovery no error or anything) it does not do anything i dont see a screen saying backup in progress or anything like that. I am running siyah kernel and a dual boot if that makes a difference. using philz touch recovery.
i ended up switching my 1st rom(omega) and 2nd rom(neat rom) after which it started working. I was trying to use it from neatrom.
Ah good info.
Yes, I suppose that's because the 2nd ROM is on /sdcard already, so it changes the location of everything else. /sdcard/clockworkmod becomes /sdcard/rom/sdcard/clockworkmod or something
ya maybe but its working now i clicked on the play button and it worked. got another strange issue with free space now i dunno whats happening to my phone one issue after another.
Ok strange issue i had an existing backup on 19 and made another backup today(21st) and it has overwritten the backup i had of the 19th there is however a file in the backup folder called index1.txt which has a path to the old backup but the path does not exist. any ideas?
1. Delete old backup (index1)
2. Make last backup an old backup (index2 becomes index1)
3. Take a new backup (index2)
You should always have 2 backups with index1 being the oldest.
Since you ran the profile many times, who knows what's right. The best thing would be to delete all backups and index files. Take ONE backup using the task if you must. That then puts the backup in the index2 slot.
If you take multiple backups on the same day, they all have the same date so they could all be deleted when index1 has that date in it
1. Delete old backup (index1)
2. Make last backup an old backup (index2 becomes index1)
3. Take a new backup (index2)
You should always have 2 backups with index1 being the oldest.
Since you ran the profile many times, who knows what's right. The best thing would be to delete all backups and index files. Take ONE backup using the task if you must. That then puts the backup in the index2 slot.
If you take multiple backups on the same day, they all have the same date so they could all be deleted when index1 has that date in it
the whole folder i had with the date of 19th is missing now. I ran the profile on 19th and made a backup then ran it again today(21st) and made another backup so technically it should have kept both backups intact.
Yes it should have, but your script does nothing different to mine.
You MUST have ran the task another time, to get that folder date in index 1.
Anyway, action to be taken as previous post. Let the profile do its business. Do not interfere with the profile and task by running it manually all the time.
Please note if you press play on the task twice in one day, even if it does not backup, the index files will change so you must avoid doing this.
Action > Delete all index files and folders in /clockworkmod/backup
Take one backup using the task
Then you will be starting fresh.
Last edited by SUroot; January 21st, 2013 at 04:07 AM.
The Following User Says Thank You to SUroot For This Useful Post:
ok i deleted both index files and ran the backup again now only have 1 index file called index2.txt. It contains information for 21_01_13 which is the new backup i created today. So now when the task runs automatically on the weekend it will create index1.txt i assume?
ok i deleted both index files and ran the backup again now only have 1 index file called index2.txt. It contains information for 21_01_13 which is the new backup i created today. So now when the task runs automatically on the weekend it will create index1.txt i assume?
So when the task runs, it will delete the folder mentioned in index1 (but this time it doesn't exist).
Then it renames index2 to index1
Then it creates a new index2 with the name of the backup its going to take.
Then it takes a backup.
To clarify, index2 is always newest backup. Index1 is always the next one to be deleted.
So it:
Deletes oldest backup
Renames newest backup to oldest backup
Creates new newest backup.
Its hard to describe. Hope it makes sense
The Following User Says Thank You to SUroot For This Useful Post:
ok quick question now sure if its possible with tasker or not i have this profile setup it is working great but i have setup a pin lock for my phone is there anyway to get tasker to enter the pin lock when it boots again after doing the backup??
sim card lock pin it comes up as soon as the phone boots. It is different to the pin/pattern lock of the lock screen. Actually it presents itself after the phone boots and comes to the lock screen and u unlock and it asks u for the pin to continue.
hey SU does this profile work for you in 4.2.1? It's not working for me. I tried manually running the profile and it does nothing(i get a message that tasker/secure settings has been granted SU status) but nothing else happens no reboot. i then had a look at the file structure i ended up cloning the profile and created a second one with the path as sh/mnt/shell/emulated/0/clockworkmod/nandroid.sh assuming it was unable to read the sh file but it still didnt work.
hey SU does this profile work for you in 4.2.1? It's not working for me. I tried manually running the profile and it does nothing(i get a message that tasker/secure settings has been granted SU status) but nothing else happens no reboot. i then had a look at the file structure i ended up cloning the profile and created a second one with the path as sh/mnt/shell/emulated/0/clockworkmod/nandroid.sh assuming it was unable to read the sh file but it still didnt work.
ohh ok cool so what exactly would need to be updated? I tried manually creating a backup to internal memory from philz touch but after it completed i could not see it in the file manager. Im guessing if i were to change the path to external sd it would solve the issue and it would work?
ohh ok cool so what exactly would need to be updated? I tried manually creating a backup to internal memory from philz touch but after it completed i could not see it in the file manager. Im guessing if i were to change the path to external sd it would solve the issue and it would work?
I've just tested this. I know it works on the S3 4.2.1.... I'm not sure about other devices....
But it should be:
# Set today's date
now=$(date +"%d_%m_%y-%H%M")
# Deletes previous archive (as contained within index1.txt)
rm -rf $(cat /sdcard/clockworkmod/backup/index1.txt)
# Moves previous backup to archive (index2 becomes index1 for delete next time)
mv /sdcard/clockworkmod/backup/index2.txt /sdcard/clockworkmod/backup/index1.txt
# Stamps new index 2
echo '/sdcard/clockworkmod/backup/'$now > /sdcard/clockworkmod/backup/index2.txt
# writes a command for recovery to read (creates index2 backup)
echo 'backup_rom("/sdcard/0/clockworkmod/backup/'$now'");' > /cache/recovery/extendedcommand
But yes, instead of above, you could set external_sd where sdcard/0 is.
The Following User Says Thank You to SUroot For This Useful Post:
ok so i updated the nandroid.sh file(with the code given above) and when i click on play it still does nothing i just get a message that tasker has been granted SU permissions.
i made the changes as said above but still nothing it does not restart the phone it just gives me the same message(tasker has been granted SU permissions). Also can i ask how did u manage to get that path for the clockworkmod folder?
I tried deleting my entire profile from tasker and re adding it again but still does not work.
you can get to the clockworkmod folder through so many different paths
/storage/emulated/legacy/clockworkmod/nandroid.sh
/storage/emulated/0/clockworkmod/nandroid.sh
/sdcard/clockworkmod/nandroid.sh
/mnt/sdcard/clockworkmod/nandroid.sh
how do we know for sure which path to use? Technically i know any one of them should work as they are all pointing to the same location. Sorry if its a dumb question but im not a linux guy.
Last edited by silentwitness; March 13th, 2013 at 01:58 AM.
im running it from tasker itself open the nandroid task and click play. So any suggestions? I tried deleting the entire profile and re creating it and it didnt seem to help. If i were to create it on the external memory(with the old script) it would work right?
sure no problem. The profile is the exact same one posted on this page i re downloaded it recently and used it. The script i copied from what you pasted above. The file is attached. Thanks for all the help and sorry for all the problems and questions.