Anonymous
Not applicable

Partitions on an Android device:

A partition is simply a discrete section on the phone’s internal storage where data is kept. What kind of data is kept on each partition depends on the hardware, operating system, and many other factors. The bootloader will have one, the system (Android OS) will have one, the user data will have one… and so on and so forth. When you see people talk about “/system” and “/cache”, they’re referring to the given names for those partitions. The OnePlus 6, for example, has 72 partitions. That sounds like a lot, but the OnePlus 6 is one of the devices that supports seamless updates which means many of these partitions are simply duplicates of each other.

 

Partial output of the partitions on the OnePlus 6. Some A/B partitions are underlined for demonstration purposes.

Screenshot_20180715-021101-2.jpgScreenshot_20180715-021041-2.jpg

For the vast majority of Android users, the partitions that we mostly deal with are system, boot, recovery, userdata and more recently vendor and vbmeta.

Here’s a brief explanation of the purpose of each partition:

  • system – holds the Android OS, system libraries, system apps, and other system media like bootanimations, stock wallpapers, ringtones, etc.
  • boot – holds the kernel, ramdisk, and on A/B devices also the recovery as well
  • recovery – holds the recovery, where TWRP is most commonly flashed on A-only devices (A/B devices don’t have a dedicated recovery partition)
  • userdata – holds all of your app, system, and internal storage data
  • vendor – holds platform and device-specific HALs, the files necessary for the Android OS to communicate with the underlying hardware
  • vbmeta – the partition for Android Verified Boot 2.0 which verifies the integrity of the boot process
  • EFS - the details of your device like IMEI, Serial number etc stored.

Device OEMs can change their partition schemes to use whatever layout they want. There are also a lot of extra partitions that may contain other system apps such as cust, product, and oem, and while these are safe to modify, it’s generally not recommended if you want to make it easier on yourself to return to stock. So where do A/B partitions play a role?

The A/B Partition Scheme

How updates work on devices with seamless updates :

The very simple image below illustrates how an update is handled on a device with A/B partition support. The partition that is illustrated is the system partition, though other partitions such as boot and vendor may also be updated with any given OTA update from an OEM. This update process happens with not only major Android version updates but also security patch updates.


image

  1. We start with two system partitions, system_a and system_b, both on the same version of Android.
  2. Assuming that system_a is active, the OTA update will patch system_b, the inactive partition, in the background.
  3. system_a is set to inactive and system_b then becomes active once the user reboots.
  4. The now-inactive partition, system_a, will be updated when the next OTA update rolls out.

What are the benefits of this update process?

  1. If an update fails, the device will roll back to the working build on the other slot.
  2. Your data is kept perfectly intact, even if the update is borked, as there is only one partition (userdata) which houses your data.
  3. Update streaming: If your data partition is full, then the update can be downloaded and streamed to the inactive slot. It’s a pretty neat feature and means that you don’t have to waste any temporary storage on your updates. That’s why there’s no cache partition on A/B devices as they’re no longer needed.

What impact does the A/B partitioning scheme have on the storage of a device?

Does the fact that seamless updates result in a bunch of duplicated partitions mean you’re losing a bunch of storage space? Not at all. Google says that devices with seamless update support should only be down about a few hundred Megabytes thanks to removing the /cache and /recovery partitions. Removing both balances the cost of adding a second set of partitions. According to Google, the Pixel’s A/B system image is half the size of the A-only system image. Most of the additional storage usage actually comes from the addition of a second vendor partition. That makes sense as the vendor partition houses all of the proprietary binaries used by OEMs (part of Project Treble), so it’s expected to take up quite a bit of space. While Google doesn’t recommend having A/B partitioning on devices with 4GB of storage (as it’s nearly 10% of total available storage), they do recommend it on devices with 8GB and higher.

 

Here’s a breakdown of the storage space used on a Google Pixel with and without A/B partitions.

 


image


Does my Android smartphone support A/B partitions for seamless updates?

To check this download an app called treble check from playstore.

 


image


How Developers View A/B Partitions

When building a ROM, developers can make use of both partitions to test separate builds. If one doesn’t work, they can just revert back to the working partition and rebuild their ROM. Developers can also test for regressions by simply installing an update, switching the active partition, and comparing the two without having to wipe data. Here’s how the LineageOS team views A/B partition support:

“Many around the Android community have bashed A/B as being ‘hard to support’ and ‘not developer friendly’, when in fact, properly implemented it is easier to support and just as developer friendly.” – jrizzoli, LineageOS Changelog 19

The initial difficulty with A/B support for developers came from modifying their existing tools to support these devices. The developer of Magisk, topjohnwu, added official support for the Google Pixel a year after it was released—not because it was difficult, but rather because it took him a year to actually obtain the device to work on. TWRP support came pretty quickly on A/B devices after the lead developer, Dees_Troy, took a crack at it. LineageOS 15.1 now supports A/B devices after volunteers found time to fix their addon.d script.

 

 

A Word on Project Treble and Seamless Updates

A common misconception is that having Project Treble support and A/B partition support are related to one another, but that’s not actually the case. Having one does not imply the other. The Motorola Moto Z2 Force uses an A/B partitioning scheme but doesn’t support Treble. On the other hand, the Honor 9 Lite supports Project Treble, yet is an A-only device.

 


image
 

Frequently Asked Questions/Summary

What are the benefits of A/B partitioning?

  • A/B partitioning allows you to update your Android smartphone while using it, simply rebooting when you’re ready to boot into the new version. It also acts as protection against bricks—if the update goes wrong you’ll go back to the working install.

How do A/B partitions affect mods such as custom kernels, Magisk, or Xposed?

  • You have to be careful when installing them, but there are currently no issues. Magisk officially supports devices with seamless updates, and so long as you flash things in the right order you should have no problems. Make sure to flash the custom kernel before flashing your other mods, and you should be good to go.

Does having an A/B partition scheme mean that I have reduced storage?

  • Nope! Google says that devices which support seamless updates only sacrifice a few hundred Megabytes of storage to support it. The benefits outweigh that cost.

My device supports A/B partitions, does that mean I can make use of a Project Treble Generic System Image?

  • Not necessarily. Project Treble and A/B support are unrelated. The Motorola Moto Z2 Force doesn’t support Project Treble, yet it supports the A/B partition scheme.

My device supports Project Treble, does that mean I have an A/B partition scheme?

  • This is not always the case. The Honor 9 Lite is a prime example as it supports Project Treble yet does not have an A/B partition scheme.

Are there any dangers with A/B partitions? How does rollback protection affect things?

  • Google has tried their hardest to make this not an issue, but in the case of the Motorola Moto Z2 Force, there were known cases of a device reactivating the older slot after upgrading to Android Oreo. This meant that rollback protection kicked in, and device owners could only rescue their smartphone with EDL recovery. Google says that rollback protection only kicks in after first boot though, so the slot needs to be fully functioning after an update before you can no longer downgrade.

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
Viki100420
Active Level 10
Thanks for providing this info👍

View solution in original post

Reply
Loading...
Aashish
Expert Level 3
Sadly Samsung doesn't have A/B partition scheme.

View solution in original post

Reply
Loading...
Anonymous
Not applicable
isiliye hi me firmware flash or smart switch recommend karta hoon ....simple si to baat hain .....me m30 use kar raha hoon ..dusra koi m30 use kar raha hain same provided software ke liye mujhme battery drain faster ...aur dusre ki device me pubg lag ...ie possible hi nehi jaha ek type ka software diya gaya dono device me ...ie only possible hain agar kisi ne totally wrong process se software install kia aur uo software fully or correctly installed na hue toh ..mobile data to recommended kabhi bhi nehi tha ....wifi tha recommended lekin totally firmware ko update kare uo wifi without a single data bar fluctuate ie aaj tak mene nehi dekha chahe keyun na uo wifi 70mmps ka speed de .aur jaha software install is a not matter of joke it's allaways need stable carrier to upload....🙂🤓🤓🤓🤓

View solution in original post

Reply
Loading...
5 Comments
Viki100420
Active Level 10
Thanks for providing this info👍

View solution in original post

Reply
Loading...
Aashish
Expert Level 3
Sadly Samsung doesn't have A/B partition scheme.

View solution in original post

Reply
Loading...
Anonymous
Not applicable
Hmm yes brother. As Google made it mandatory we may get it in devices releasing with 11.
Reply
Loading...
Anonymous
Not applicable
Check my new post too🤗🤗. Mention if I missed anything 🤔🤔
Reply
Loading...
Anonymous
Not applicable
isiliye hi me firmware flash or smart switch recommend karta hoon ....simple si to baat hain .....me m30 use kar raha hoon ..dusra koi m30 use kar raha hain same provided software ke liye mujhme battery drain faster ...aur dusre ki device me pubg lag ...ie possible hi nehi jaha ek type ka software diya gaya dono device me ...ie only possible hain agar kisi ne totally wrong process se software install kia aur uo software fully or correctly installed na hue toh ..mobile data to recommended kabhi bhi nehi tha ....wifi tha recommended lekin totally firmware ko update kare uo wifi without a single data bar fluctuate ie aaj tak mene nehi dekha chahe keyun na uo wifi 70mmps ka speed de .aur jaha software install is a not matter of joke it's allaways need stable carrier to upload....🙂🤓🤓🤓🤓

View solution in original post

Reply
Loading...