I'm seeing mixed opinions (such is life...LOL) about whether or not to do a full wipe, a cache & dalvik-cache wipe, or no wipe at all prior to a restore. What is the proper way to do this? I think I have always wiped prior to a restore but now I'm not so sure I have to perform a full wipe.
Ha such is the debate. We may never no for sure. I always wipe but technically a restore overwrites everything you backed up with it. That being said if you didn't back up cache it wont overwrite it so a cache wipe would be in order...
I'm seeing mixed opinions (such is life...LOL) about whether or not to do a full wipe, a cache & dalvik-cache wipe, or no wipe at all prior to a restore. What is the proper way to do this? I think I have always wiped prior to a restore but now I'm not so sure I have to perform a full wipe.
It may not be necessary to do a full wipe, but I would rather full wipe then write over empty space than to miss something and have to do it all over again.
When you do a nandroid restore, it's basically the same as flashing a new rom, except all your data is already there. So, just like when you flash a new rom, its always a good idea to wipe everything first. IMO, it only takes a few seconds, and anytime there are issues, this always fixes it. So it doesnt make any sense to NOT wipe everything first. As long as you make a nadroid backup before you restore, there is nothing that can go wrong.
And then that raises the question... is the FormatAll.zip enough? lol. I guess it only takes a moment or so to do both, so that's simple enough for me.
And then that raises the question... is the FormatAll.zip enough? lol. I guess it only takes a moment or so to do both, so that's simple enough for me.
Okay, so I've seen enough threads on this now to where I felt it was appropriate to do a little more research on the subject. The short answer - no, you don't need to wipe before restoring a nandroid backup (confirmed with RA, only). Should you wipe? Well, it certainly can't hurt. It takes only a few seconds, and it will guarantee that you have no issues. That being said, recovery wipes partitions before restoring them, with the exception of those that are written to via flash_image (boot, for example). The case of the latter, whatever was there gets overwritten anyway.
So, here is what I found. Recovery relies on a shell script written and modified by various people. More likely than not, all recoveries are going to use this. This is not to say that this script is not modified for each specific recovery, though. That being said, the method used to backup/restore is going to be essentially the same for, say, RA and CW, for example. That doesn't necessarily mean that you *should* try to restore a backup from one with the other. But, it would probably work for some partitions such as boot, system, and data, at the very least. Anyway, this script is called nanadroid-mobile.sh.
Here is how RA runs nandroid-mobile.sh when running a restore:
/sbin/nandroid-mobile.sh -r -e -a --norecovery --nomisc --nosplash1 nameofbackup
nandroid-mobile.sh has many different options, which means if you were to run it from the command line manually (still in recovery), you could do a great deal more than what the built-in backup/restore options show. That being said, this restore command means this:
-r = restore
-e = include ext partition (skip if it doesn't exist)
-a = include .android_secure (skip if it doesn't exist)
--norecovery = don't restore recovery.img
--nomisc = don't restore the misc partition
--nosplash1 = don't restore the splash screen
nameofbackup = the name of the backup to restore
This is the default, but it will pick up whatever you want to include/exclude and add it to that command. For example, if you uncheck data when restoring a backup, it will add --nodata to the command, and skip it.
Now, when this is executed, it does several different things, but here is the relevant part:
for image in boot recovery; do
if [ "$NOBOOT" == "1" -a "$image" == "boot" ]; then
$ECHO ""
$ECHO "Not flashing boot image!"
$ECHO ""
continue
fi
if [ "$NORECOVERY" == "1" -a "$image" == "recovery" ]; then
$ECHO ""
$ECHO "Not flashing recovery image!"
$ECHO ""
continue
fi
$ECHO "Flashing $image..."
$flash_image $image $image.img $OUTPUT
done
for image in data system; do
if [ "$NODATA" == "1" -a "$image" == "data" ]; then
$ECHO ""
$ECHO "Not restoring data image!"
$ECHO ""
continue
fi
if [ "$NOSYSTEM" == "1" -a "$image" == "system" ]; then
$ECHO ""
$ECHO "Not restoring system image!"
$ECHO ""
continue
fi
$ECHO "Erasing /$image..."
cd /$image
rm -rf * 2>/dev/null
$ECHO "Unpacking $image image..."
$unyaffs $RESTOREPATH/$image.img $OUTPUT
cd /
sync
umount /$image
done
If you understand shell scripting, this should be pretty obvious. If not, it's basically going through the partitions, upacking the image files, and replacing what was there with the contents of the image. This part here:
rm -rf * 2>/dev/null
Means to recursively force remove all files in the current (as defined by the loop for $image) path (system, data, etc.) and don't show any errors. It does this before unpacking the image and copying the files.
Note in the above, though, that it only runs this if you included the image to be restored. If you don't select data as part of a restore, you will still have the contents of /data after the restore. What does that mean?
It means that if you want to restore a clean nandroid backup of a ROM, but without any apps, you must wipe data, first. Granted, sometimes, you want to do this. Some people do the opposite, and restore the data.img, only, skipping /system, which will restore you apps/settings from a backup, only, leaving your current ROM in tact. Is it a good idea to do that? Maybe. Some people claim they have no issues from doing that.
In any case, what I don't see here is any mention of /cache. So, if your backup does not include cache, I would suggest you at least wipe that. Dalvik cache is included in /data, by default, so no need to wipe it unless you keep it in /cache.
If anyone is interested in the backup process, as well, I can run through that, too. Otherwise, this is basically how the restore works. It uses something called unyaffs to unpack the .img files. I wrote up a reply in another thread somewhere on how to do this manually in windows, and extract files from backups (including build.prop to find out what ROM a backup is of).
Otherwise, on a completely unrelated note, here is something I learned. As long as you have root, you can find your hboot version without booting into hboot by typing this from the command line:
cat /proc/cmdline
That will give you quite a bit of information (including your device ID, which RA uses in the path for your nandroid backups) along with your hboot version. Yeah, unrelated, but cool none the less.
Oh, and I'll go ahead and throw this out there, too. I'm not discouraging wiping before restoring a nandroid backup. Recovery does use a different, actual format, method for wiping partitions when you select the wipe option, as opposed to just removing files like nandroid restore does. If you want to be sure all is well, go ahead and wipe first, which I would recommend when switching between AOSP and sense ROMs. The fact still remains, though, that for casual nandroid restores, wiping isn't all that necessary, beyond cache, which I'll still recommend.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.