A/B Partition Wipe - Essential Phone Questions & Answers

Delete

unless rooting you can technically flash all to either one as far as I'm aware, as long as they are all flashed to the same partition. The reason for two of them is so that have another fully functional image on the other partition in case things go awry.

Related

[Q] N7 Factory Reset: Have to Unlock and Root again?

Ok, I come from the Apple world where you have to restore the iPhone / iPad first to update to the latest iOS then re-jailbreak.
With the N7, if I wanted to upgrade to a newer version of Android (currently on 4.2.2, so whatever comes next), would I have to re-flash the N7 to stock 4.2.2 then re-unlock and re-root it?
What if I just want to do a factory reset to start over? Do I have to re-flash stock 4.2.2 then re-unlock and re-root in that case too?
Synomenon said:
Ok, I come from the Apple world where you have to restore the iPhone / iPad first to update to the latest iOS then re-jailbreak.
With the N7, if I wanted to upgrade to a newer version of Android (currently on 4.2.2, so whatever comes next), would I have to re-flash the N7 to stock 4.2.2 then re-unlock and re-root it?
What if I just want to do a factory reset to start over? Do I have to re-flash stock 4.2.2 then re-unlock and re-root in that case too?
Click to expand...
Click to collapse
To do an official ota yes. There are stock odexed/deodexed ROMs you can flash in the dev forums without having to go through that though.
Sent from my Paranoid 3.0 Nexus7 running M-Kernel mr1
Locking/unlocking of the boot loader is completely independent from other "rooting" activity. Under normal circumstances, it is only unlocked once and then left that way.
In Android, there are 5 principal partitions: recovery, boot, system, data, and cache. In pure stock devices, it is intended that recovery, boot, and the system partition are always used in a read-only fashion by the end user. All user changes, customizations, settings, and data are recorded into the data (sometimes also called "userdata") partition. (The cache partition is used for temporary/transient stuff)
So, the Android "factory reset" is not precisely what you are thinking of - it is a procedure which erases only the cache and data partitions. IT RESTORES NOTHING - IT ONLY DELETES.
So, if a device "rooter" comes along and alters the boot/recovery/system partition, those changes stay on the tablet/phone even when a "factory reset" procedure is performed. THOSE CHANGES CAN BREAK THE SUCCESSFUL INSTALL OF AN OTA BUNDLE, so, yes - it is generally cleaner to install a pure stock ROM for the purposes of performing an OTA upgrade... at which point you need to re-root and re-customize ( not including the boot loader unlock step).
One more thing, too: because the Nexus 7 has no physical SD card, it has an "emulated" SD card which is stored in the /data (userdata) partition. When the "stock recovery" performs a "factory reset", it erases EVERYTHING in /data - including this psuedo SD card! The newer versions of the CWM or TWRP custom recoveries define "factory reset" a little differently - they erase everything except what is stored in the /data/media/ folder - the location of the emulated SD card (usually /data/media/0). This is important to understand, as your backups will be stored in there.
HTH
PS There is no need for you to "hurry up and install an OTA" if you are using a well supported custom ROM - generally after a few weeks a ROM dev will rebase their ROM onto the new release, and you can simply "dirty flash" the replacement ROM over the top of the existing ROM. That will save you some effort if you just wait a little.
So I just unlocked and rooted my N7 last night.
Since it is unlocked and rooted, do I have to do anything different if I want or have to perform a factory reset (using the hardware buttons to go into recovery mode and use the "wipe data/factory reset" option)?
If I do this factory reset, it stays unlocked right? Does it stay rooted too?
Synomenon said:
If I do this factory reset, it stays unlocked right? Does it stay rooted too?
Click to expand...
Click to collapse
Yes and Yes.
PS. The most important skill set you can develop right now is making backups using the custom recovery. You should be 100% comfortable using the backup/restore menus of the custom recovery ... and almost as important knowing where they are stored so you can get copies of them off the tablet for safe keeping.
Thank You!
bftb0 said:
Locking/unlocking of the boot loader is completely independent from other "rooting" activity. Under normal circumstances, it is only unlocked once and then left that way.
In Android, there are 5 principal partitions: recovery, boot, system, data, and cache. In pure stock devices, it is intended that recovery, boot, and the system partition are always used in a read-only fashion by the end user. All user changes, customizations, settings, and data are recorded into the data (sometimes also called "userdata") partition. (The cache partition is used for temporary/transient stuff)
So, the Android "factory reset" is not precisely what you are thinking of - it is a procedure which erases only the cache and data partitions. IT RESTORES NOTHING - IT ONLY DELETES.
So, if a device "rooter" comes along and alters the boot/recovery/system partition, those changes stay on the tablet/phone even when a "factory reset" procedure is performed. THOSE CHANGES CAN BREAK THE SUCCESSFUL INSTALL OF AN OTA BUNDLE, so, yes - it is generally cleaner to install a pure stock ROM for the purposes of performing an OTA upgrade... at which point you need to re-root and re-customize ( not including the boot loader unlock step).
One more thing, too: because the Nexus 7 has no physical SD card, it has an "emulated" SD card which is stored in the /data (userdata) partition. When the "stock recovery" performs a "factory reset", it erases EVERYTHING in /data - including this psuedo SD card! The newer versions of the CWM or TWRP custom recoveries define "factory reset" a little differently - they erase everything except what is stored in the /data/media/ folder - the location of the emulated SD card (usually /data/media/0). This is important to understand, as your backups will be stored in there.
HTH
PS There is no need for you to "hurry up and install an OTA" if you are using a well supported custom ROM - generally after a few weeks a ROM dev will rebase their ROM onto the new release, and you can simply "dirty flash" the replacement ROM over the top of the existing ROM. That will save you some effort if you just wait a little.
Click to expand...
Click to collapse
Thank you bftb0:good::good:

Oneplus 5 Partitions and purposes?

So after moving to this phone form a rather humble galaxy nexus the partition layout is much more complex I know what a lot of the partitions do but a few I have no clue.
So in the interest of explorations let's see if you guys can help fill me in:
Boot (Self explanitory the boot partition for the kernel bootstrap)
Cache (Self explanitory the standard android cache partition)
Recovery (Recovery partition where TWRP goes or stock recovery)
System (System partition that is in use aka the OS)
System Image (??? What is this an image of system as shipped form factory?)
Data (User data partition)
Modem (??? The factory modem drivers?)
EFS (I hear this is the IMEI MAC and other modem setting the phone needs for connectivity)
Question mainly revolves around the system image partition I take it this is put in place to recover from a very bad flash from factory. Out of curiosity does this every get overwritten say during official updates? I'm curious if anyone knows if it's possible to get the system image partition back after a wipe it's a possible mod say after warranty period although right now I wouldn't touch that 3GB partition.
It's supposedly a "feature" of TWRP used to create a stock ROM image in case you ever want to restore to the original ROM or when you want to get OTA updates.
Don't know how accurate that info is, as I've just found it by googling a bit. It's present on other, older, phones too. So it's definitely not unique to OnePlus.

Need a little help understanding A/B partitions

I have a few questions I'm new to the a/b partitions thing I've read the page on a/b partitions. But I'm still in the mud.
1 I'm on Verizon bootloader unlocked twrp 3.2.3-23 and magisk installed I have 9.0.11 installed twrp and magisk in slot a/b
now is it necessary to backup stock rom? If I install lets say crDroid in slot A install twrp installer I know twrp goes into both slots reboot back to recovery making sure I'm still in A install gapps and magisk reboot back to recovery making sure again I'm still in A slot then reboot to crDriod that should work yes?
2 Now If I wanted to go back to my stock rom witch is in B slot can I not reboot back to twrp and switch to slot B and go to stock?
Thanks guys this A/B partition is still clear as mudd
Making a back up is always recommend, but it's up to the user to decide if the want to or not. The down side is loosing all your data, so there is that.
The short answer to your 2nd question is no you can not dual boot ROMs on this device. I posed the same question in a different thread and you can read the explanation from Dark Nightmare here.
https://forum.xda-developers.com/showpost.php?p=78375631&postcount=988
Sent from my ONEPLUS A6013 using Tapatalk
foamerman said:
I have a few questions I'm new to the a/b partitions thing I've read the page on a/b partitions. But I'm still in the mud.
1 I'm on Verizon bootloader unlocked twrp 3.2.3-23 and magisk installed I have 9.0.11 installed twrp and magisk in slot a/b
now is it necessary to backup stock rom? If I install lets say crDroid in slot A install twrp installer I know twrp goes into both slots reboot back to recovery making sure I'm still in A install gapps and magisk reboot back to recovery making sure again I'm still in A slot then reboot to crDriod that should work yes?
Click to expand...
Click to collapse
I'm new to A/B as well but have been flashing quite a bit. Maybe someone can correct me if I'm wrong. From what I've observed, ROMs are designed to flash to the slot you're not using and, on reboot, switch slots. TWRP zip installer is designed to install to both slots. Magisk and Gapps, however, install to the current slot. This means you should flash the ROM (which flashes to the non-active system and boot partitions and possibly others), flash the TWRP installer (which installs to both boot partitions, including the one that was just flashed). Then reboot back into recovery (which will be the other slot that the ROM was installed to), and then install all the other zips needed (i.e., Gapps, Magisk, etc...).
Switching A/B partitions in the TWRP reboot menu also triggers the partition switch after reboot, if needed. It doesn't seem to immediately switch before a reboot however, even though it gives that impression.
foamerman said:
2 Now If I wanted to go back to my stock rom witch is in B slot can I not reboot back to twrp and switch to slot B and go to stock?
Click to expand...
Click to collapse
The data partition, which contains user apps and system and user app data, is not slotted. Moving back and forth between slots that share a common ROM type and are close in version might not pose a problem. But A/B slotting wasn't designed for switching Roms back and forth. It was designed to try to ensure that there is always a valid bootable ROM without regard to use data (i.e., potentially, after a factory-reset). Don't expect to boot up an AOSP modded ROM using the data and apps from an OygenOS ROM. Do a backup of all partitions to be safe (with the exception of system and vendor since system_image and vendor_image give a bit-for-bit copy, instead of file-for-file copy). Copy the TWRP directory to a computer afterward, if possible. Make sure to wipe data if flashing a ROM of a different type, not just a different version (after flashing everything but before initial system boot).
phillymade said:
Making a back up is always recommend, but it's up to the user to decide if the want to or not. The down side is loosing all your data, so there is that.
The short answer to your 2nd question is no you can not dual boot ROMs on this device. I posed the same question in a different thread and you can read the explanation from Dark Nightmare here.
https://forum.xda-developers.com/showpost.php?p=78375631&postcount=988
Sent from my ONEPLUS A6013 using Tapatalk
Click to expand...
Click to collapse
Nsane457 said:
I'm new to A/B as well but have been flashing quite a bit. Maybe someone can correct me if I'm wrong. From what I've observed, ROMs are designed to flash to the slot you're not using and, on reboot, switch slots. TWRP zip installer is designed to install to both slots. Magisk and Gapps, however, install to the current slot. This means you should flash the ROM (which flashes to the non-active system and boot partitions and possibly others), flash the TWRP installer (which installs to both boot partitions, including the one that was just flashed). Then reboot back into recovery (which will be the other slot that the ROM was installed to), and then install all the other zips needed (i.e., Gapps, Magisk, etc...).
Switching A/B partitions in the TWRP reboot menu also triggers the partition switch after reboot, if needed. It doesn't seem to immediately switch before a reboot however, even though it gives that impression.
The data partition, which contains user apps and system and user app data, is not slotted. Moving back and forth between slots that share a common ROM type and are close in version might not pose a problem. But A/B slotting wasn't designed for switching Roms back and forth. It was designed to try to ensure that there is always a valid bootable ROM without regard to use data (i.e., potentially, after a factory-reset). Don't expect to boot up an AOSP modded ROM using the data and apps from an OygenOS ROM. Do a backup of all partitions to be safe (with the exception of system and vendor since system_image and vendor_image give a bit-for-bit copy, instead of file-for-file copy). Copy the TWRP directory to a computer afterward, if possible. Make sure to wipe data if flashing a ROM of a different type, not just a different version (after flashing everything but before initial system boot).
Click to expand...
Click to collapse
OK I understand what you both are saying my understanding is that data is still there in both slots yes? so If I want to go back to my 9.0.11 stock rom I should be able to just reboot to twrp and select slot B and go back to to stock yes? guys I'm sorry this is my first A/B partition phone I'm just trying to figure it out
foamerman said:
OK I understand what you both are saying my understanding is that data is still there in both slots yes?
Click to expand...
Click to collapse
As long as it isn't wiped, yes.
foamerman said:
so If I want to go back to my 9.0.11 stock rom I should be able to just reboot to twrp and select slot B and go back to to stock yes? guys I'm sorry this is my first A/B partition phone I'm just trying to figure it out
Click to expand...
Click to collapse
No. Except for the possible exception that both slots contain different versions of the same ROM, the data will work with one ROM but not the other.
When flashing a ROM in TWRP, just mke sure to make a nandroid backup first and follow the installation directions. If you have to switch back, you will need to flash the nandroid backup.
It is a pain and there are pitfalls. This phone is relatively new and this is the cost of flashing a custom ROM/bootloader.
No. Except for the possible exception that both slots contain different versions of the same ROM, the data will work with one ROM but not the other.
When flashing a ROM in TWRP, just mke sure to make a nandroid backup first and follow the installation directions. If you have to switch back, you will need to flash the nandroid backup.
It is a pain and there are pitfalls. This phone is relatively new and this is the cost of flashing a custom ROM/bootloader.[/QUOTE]
OK one more I think lol If I have 9.0.11 on my internal storage can I not go into slot A and wipe it and install it back on there and be OK?
foamerman said:
OK one more I think lol If I have 9.0.11 on my internal storage can I not go into slot A and wipe it and install it back on there and be OK?
Click to expand...
Click to collapse
Internal storage is an encrypted folder in the data partition that is wiped separately from data. As long as you don't wipe internal storage for any reason it should be ok, in theory. But it's not in practice.
Most of the problem with this phone is maintaining encryption back and forth between ROMs. Honestly, if you can't afford to lose data, don't try to flash ROM's yet. I have had very little luck flashing back and forth and, after reflashing data, being able to avoid a bootloop. TWRP has only supported encryption on this phone for a month or so and IMHO it's not ready for prime time. I have relied on Titanium Backup and moved it's backup folder back and forth between my phone and computer.
Nsane457 said:
Internal storage is an encrypted folder in the data partition that is wiped separately from data. As long as you don't wipe internal storage for any reason it should be ok, in theory. But it's not in practice.
Most of the problem with this phone is maintaining encryption back and forth between ROMs. Honestly, if you can't afford to lose data, don't try to flash ROM's yet. I have had very little luck flashing back and forth and, after reflashing data, being able to avoid a bootloop. TWRP has only supported encryption on this phone for a month or so and IMHO it's not ready for prime time. I have relied on Titanium Backup and moved it's backup folder back and forth between my phone and computer.
Click to expand...
Click to collapse
Well the mud is starting to clear up a little. Yea I've been a little leery about trying to install roms yet. I have read all the post in the Recovery thread mauronofrio is getting a 6t soon so maybe he can figure it out. But again Thank you.

Techincal Question About Wiping System with Custom ROM

So I've seen with installing custom ROMs that there are steps that basically say, "Do not wipe system" in TWRP. I have noticed in doing things the dumb way that I can wipe every partition but the only way it becomes unrecoverable is if system is wiped, this is even if I install a custom ROM in its place. Can someone help me understand what has changed with A/B partition or OnePlus security settings where OOS system partition must be intact to allow one to run a custom ROM?
The reason I ask is that unless it is a byte for byte overwrite then we leave OOS files on parts of the custom ROM storage partition and if it is bit for bit write why would erasing the partition matter?
What seems more important for custom ROM is to not wipe data before rebooting in TWRP to flash magisk. So a clean flash is now flashing the ROM, flashing TWRP then reboot in TWRP and then only wiping data and art. Then flashing magisk. This is important to keep decryption working. That means not using factory reset feature either, always wiping with manually selected partitions.
Anyway wiping system is useless as the flashing script wipes it anyway.

Pixel 4 (nandroid)

So since there in no TWRP for the pixel 4 currently is there anyway too make a nandroid backup?
If I remember correctly this is where the entire partition(s) is/are backed up like as in a snapshot was taken of the way every little minute detail about it was arranged. Since TWRP does this backing up for us and it's not available how can we back up our phones in this type of detail? Titanium does a decent job but it's not an actual exact duplicate of the way things were at a certain point in time on the partition like a nandroid is. Basically, if someone flashes a ROM (one not requiring TWRP to flash, namely pixeldust, I believe it has a patched boot partition allowing unsigned files to be flashed w/ stock recovery) and something hangs it up for whatever reason there needs to be a nandroid backup to revert to if the flash goes to hell in a hand basket, right?
Is there a way to make an old skool nandroid like TWRP makes?
One could ADB pull partition copies to make backups of partitions but how this would turn out with the android 10 "dynamic partitions" is still beyond my understanding.

Categories

Resources