I've found two ways of wiping and reinstalling my rom. One way uses fastboot and the other TWRP recovery. I'd like to find out how they correlate with each other.
Method 1: Fastboot
Format data
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot flash bootloader bootloader.img
fastboot reboot-bootloader
fastboot flash radio radio.img
fastboot reboot-bootloader
fastboot flash recovery recovery.img
Transfer rom zip files and install them
Method 2: TWRP
Simply format data and wipe every checkbox
Transfer rom zip files and install
What are you specifically looking to find? TWRP probably just issues the fastboot commands.
You don't need to flash the bootloader, modem, or recovery unless their are new ones available. Flashing them again is just redundant and a waste of time. Personally I only use fastboot to flash my bootloader,modem, or new version of TWRP. I use TWRP for literally everything else. You can wipe the partitions easier and quicker than using fastboot, or you can format data and completely nuke the phone and disable encryption. I'm not sure why you're asking how they correlate, I'm pretty sure it's common sense. If you erase a partition in fastboot, it's the exact same thing as wiping the partition in TWRP.
Also if you want to reinstall your ROM why are you wiping your whole internal storage? This is pretty much never required unless you want to free up space or decrypt the device. If you just wipe every partition but internal storage, you can keep local files (like Titanium Backup, pictures, music, any files you have on there, etc..). Then when you flash the ROM, it's still a clean flash because your system, data, cache, and boot partitions are already wiped.
The most important thing for me is that with Twrp-recovery, there is no other device needed; PC etc.
Related
After backup, in my nandroid folder, the file 'ext.tar' is apparently corrupt, Nandroid restore is not working, (although it reports 'completed' but no boot). Bart restore gives this error: 'invalid tar magic'.
So my questions are, can the .tar be repaired and/or can I do a restore via fastboot without the ext.tar? (will the sd-ext contents be intact? I haven't done anything to it)
If I try the restore, my steps using the contents of the nandroid folder, would be:
Code:
fastboot erase system
fastboot erase userdata
fastboot erase cache
fastboot erase boot
fastboot flash boot boot.img
fastboot flash cache cache.img
fastboot flash userdata data.img
fastboot flash system system.img
then reboot
correct?
Solved: - Not enough space on SD card
pardus said:
Code:
fastboot erase system
fastboot erase userdata
fastboot erase cache
fastboot erase boot
fastboot flash boot boot.img
fastboot flash cache cache.img
fastboot flash userdata data.img
fastboot flash system system.img
Click to expand...
Click to collapse
that will restore the nandroid.. (usually I don't restore cache unless you have offloaded some of the rom to cache to force it to fit into a smaller space)
however the /sd-ext is backed up to the tar file. (you might try extracting it on your computer... sounds like the header of the file is malformed.. I won't know about the rest.)
Of course if you just want to restore the system.. and the contents of /sd-ext have not changed this is not an issue.. fastboot can't modify the sdcard, least with the steps mentioned.
Thank you for the reply, the cache.img file is very small so I skipped that one. Tried the above but no-go.
On my PC the tar only extracts about half the contents and gives a 'corrupt archive error' (winrar).
This all started when I flashed the oc614 kernel, but found everything even slower and then tried to restore with Nandroid and/or Bart.
I have now reflashed the rom (using your post here: http://ip208-100-42-21.static.xda-developers.com/showpost.php?p=8427522&postcount=1844) and am back to 'stock' but I would still like to restore what I had before the kernel flash.
Would I just need to flash 'system' and 'userdata' from the nandroid folder to get back there?
Weird things, when ever I do a:
Bart backup the 'ext-backup.tar' file is always corrupt or a
Nandroid + Ext Backup the 'ext.tar' file is always corrupt
??
What is the syntax for making a .tar backup from console or adb?
How do I format my fastboot cache partition? Every other time I need to enter recovery, it can't, and I need to connect my phone to a computer and 'fastboot erase cache'. I believe if I could format the partition, it could fix the problem.
bloodrain954 said:
How do I format my fastboot cache partition? Every other time I need to enter recovery, it can't, and I need to connect my phone to a computer and 'fastboot erase cache'. I believe if I could format the partition, it could fix the problem.
Click to expand...
Click to collapse
You need a Folder with fastboot.exe, AdbWinApi.dll, and AdbWinUsbApi.dll
Then you open a cmd window, and navigate to the Folder. Then you type fastboot erase Cache.
I also had the Problem, that i couldn't enter recovery. It said entering recovery, and then simply rebooted. What helped me was simply re-flashing the recovery. I hope that helps you.
That's the problem, it happens ALL the time. I need to FORMAT, not ERASE my cache. I believe the formatting is screwed.
BUMP
Phone: xt1060, verizon, Moto X Dev edition (2013)
ROM: Cm 12.1 (however, I was unable to encrypt with my last ROM as well)
My data directory is formatted with f2fs. When I attempt to encrypt the phone, it reboots without error and without any encryption action. I've used logcat to capture these messages:
I/Cryptfs ( 242): Check if PFE is activated on Boot
E/Cryptfs ( 242): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata
E/Cryptfs ( 242): Error getting crypt footer and key
E/Cryptfs ( 242): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata
E/Cryptfs ( 242): Not a valid ext4 superblock
E/Cryptfs ( 242): Orig filesystem overlaps crypto footer region. Cannot encrypt in place.
Click to expand...
Click to collapse
Because of the "Not a valid ext4 superblock" error, I tried changing the file system to ext4. When I boot after changing the data partition to ext4, the phone enters a boot loop. It boots up to an error that says "encryption unsuccessful" and the only choice is to reset the phone. I reset the phone and it boots back to the same error. I've formatted cache, system, data and sdcard, reinstalled both ROM and recovery and still I boot back up into this error message even though I am not presently trying to encrypt.
I read about a problem which requires the data partition to be reduced in size by at least 16KB, so I reduced it by about 4MB. The data partition was 27606912 blocks, and I reduced the partition to 27606000 blocks. However, this had no affect.
I have changed the partition back to f2fs because at least the phone boots using this file system without entering the "encryption unsuccessful" loop.
I have tried multiple recoveries in case that was the problem. I've tried CWM, the recovery for CM 12.1, and the most recent TWRP. I get the same problem in each of these.
I am most baffled about the boot loop after formatting the partitions in ext4 then installing a fresh ROM. Apparently my attempt to encrypt is remembered somewhere other than system, data, cache, or sdcard?
I considered flashing back to factory, however, I do not have the files, the links I've found on xda are broken, and I am waiting on Motorola to provide me access to the stock firmware - I requested it tonight though.
I appreciate any assistance that can be offered. Thank you.
I found the factory firmware and I attempted following the directions for a factory restore:
$ fastboot flash partition gpt.bin
$ fastboot flash motoboot motoboot.img
$ fastboot reboot-bootloader
$ fastboot flash logo logo.bin
$ fastboot flash boot boot.img
$ fastboot flash recovery recovery.img
$ fastboot flash system system.img
$ fastboot flash modem NON-HLOS.bin
$ fastboot erase modemst1
$ fastboot erase modemst2
$ fastboot flash fsg fsg.mbn
$ fastboot erase userdata
$ fastboot erase cache
$ fastboot reboot
Click to expand...
Click to collapse
However, the system.img failed. So, I reflashed recovery to TWRP and found that I did not have a system, data, cache or sdcard partition. I reflashed recovery to CWM because it has a custom format option and I formatted data, cache, system and sdcard using ext4, then I reflashed recovery to TWRP and because I am able to transfer files using TWRP. I transferred the CM 12.1 and gapps images, flashed them both, then rebooted.
After all of that, I still booted up into an "encryption failed" screen!
I then went back into TWRP, changed the data partition to f2fs, then I was able to boot into the new CM 12.1. So, the exact same problem exists: using f2fs, I am unable to encrypt the phone. Using ext4, I am stuck in an "encryption failed" loop.
I'm giving this thread a bump in hopes someone can share a solution with me as I am still having the same problem.
I'm on Verizon Developer Edition, but I had a similar problem after the Lolipop update. I just got it working. I had to flash the moto recovery back and format data and cache through there. Then I could encrypt. I'm gonna try to restore a backup from TWRP onto my encrypted data partition now.
I used the recovery from 47-vzw_xt1060_444-kxa2112-l126_cfc_1ff (google the file I can't post links). I'm not sure if its totally perfect with lolipop, but it formatted my data to work with encryption (ext4).
Same issue here on Moto X (ghost) with cm-12.1-20151007-SNAPSHOT-YOG4PAO332 and cm-12.1-20151105-NIGHTLY.
I could get rid of the message
E/Cryptfs ( 242): Orig filesystem overlaps crypto footer region. Cannot encrypt in place
Click to expand...
Click to collapse
by applying the update from this thread, but the other error messages still remain and I cannot encrypt my device..
I want to wipe as much as possible before clean installing a ROM. I've been using this guide.
Basically what I do is format data in TWRP and then:
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
then:
fastboot flash bootloader
fastboot flash radio
fastboot flash recovery
after that:
reboot into TWRP and flash the ROM's zip
Is this a good method of wiping everything before a clean install?
enginuity2 said:
I want to wipe as much as possible before clean installing a ROM. I've been using this guide.
Basically what I do is format data in TWRP and then:
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
then:
fastboot flash bootloader
fastboot flash radio
fastboot flash recovery
after that:
reboot into TWRP and flash the ROM's zip
Is this a good method of wiping everything before a clean install?
Click to expand...
Click to collapse
It's much easier to just wipe everything but internal storage in TWRP and then flash zip. No need for fastboot.
RatchetPanda said:
It's much easier to just wipe everything but internal storage in TWRP and then flash zip. No need for fastboot.
Click to expand...
Click to collapse
What would that leave behind? Apps?
enginuity2 said:
What would that leave behind? Apps?
Click to expand...
Click to collapse
It leaves behind absolutely nothing except your internal storage. I will go over the partitions in TWRP.
system - all the system stuff - wipe this
data - all your apps, wipe this
internal storage - things in your SD card ie. your pictures you don't want to wipe this. it has no effect on a ROM.
cache dalvik&ART- you want to wipe this
Please Help,
I recently rooted my phone and flashed it with TWRP 3.0.0 recovery where I instilled Ressurection Remix Rom
Before flashing ROM, i followed these steps:
1 Unlock the bootloader
2 Flash custom recovery TWRP 3.0.0
3 Select ‘wipe data / format to delete encryption
4 Subsequently Install ZIP with Custom ROM
5 Subsequently Install GAPPS
The installation completed succesfully and after reboot i face following problems:
1. the internal Memory became much less I have 53 GB instead original 64.
That seems really weird to me since custom ROM is about 500MB and GAPPS are only 150 MB.
If I go to the file Manager on the Phone, PC or TWRP recovery I see that the total available space is only 53GB (((
Tried to put ORIGIAL ROM through TWRP recovery - although ROM space stays at 53GB(((
Tried to Flash ORIGINAL ROM through MI-FLASH-MODULE - however I cannot - gives me a fault ...
One more thing i have noticed is when i'm in TWRP recovery and try to install a new zip, I can see all the folders which my phone memory had; however I cannot see those files through any file manager. Why is it visible at that time? - could these files take extra 11GB? how to delete them?
Please HELP it is the first phone I rooted in my life and I really don't know it further
You have to format data in twrp
giardux91 said:
You have to format data in twrp
Click to expand...
Click to collapse
1. Just went to FASTBOOT where I did the following:
fastboot erase misc
fastboot erase recovery
fastboot erase boot
fastboot erase system
fastboot erase cache
fastboot erase userdata
2. Secondly through FASTBOOT I flashed TWRP recovery again
3. Thirdly in TWRP recovery went to WIPE and formated disc, but still my memory is only 53 GB.....(((
Where am I loosing 11 GB or ROM memory?
Please help
dual system partition ??
d.lnk said:
1. Just went to FASTBOOT where I did the following:
fastboot erase misc
fastboot erase recovery
fastboot erase boot
fastboot erase system
fastboot erase cache
fastboot erase userdata
2. Secondly through FASTBOOT I flashed TWRP recovery again
3. Thirdly in TWRP recovery went to WIPE and formated disc, but still my memory is only 53 GB.....(((
Where am I loosing 11 GB or ROM memory?
Please help
Click to expand...
Click to collapse
What 11 GB? On the official global stable I have 57.84 GB in total. You probably never going to have more than 53 GB on a custom rom.
abyssq said:
What 11 GB? On the official global stable I have 57.84 GB in total. You probably never going to have more than 53 GB on a custom rom.
Click to expand...
Click to collapse
Hi all,
since It is the first root - could you explain it to me why do I have 53GB instead 64GB?
Is there any option to have 64GB rom instead 53GB?
I guess 500 MB custom rom is smaller than 1.2GB Xiaomi stock.
thanks