
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 11:42 AM (Last edited 07-25-2020 11:47 AM ) in
Tech TalkPartitions 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.
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.
- We start with two system partitions, system_a and system_b, both on the same version of Android.
- Assuming that system_a is active, the OTA update will patch system_b, the inactive partition, in the background.
- system_a is set to inactive and system_b then becomes active once the user reboots.
- The now-inactive partition, system_a, will be updated when the next OTA update rolls out.
What are the benefits of this update process?
- If an update fails, the device will roll back to the working build on the other slot.
- Your data is kept perfectly intact, even if the update is borked, as there is only one partition (userdata) which houses your data.
- 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.
Does my Android smartphone support A/B partitions for seamless updates?
To check this download an app called treble check from playstore.
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.
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.
Solved! Go to Solution.
3 Solutions
Accepted Solutions
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 11:49 AM in
Tech Talk
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 12:06 PM (Last edited 07-25-2020 12:06 PM ) in
Tech Talk
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 03:04 PM (Last edited 07-25-2020 03:05 PM ) in
Tech Talk- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 11:49 AM in
Tech Talk
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 12:06 PM (Last edited 07-25-2020 12:06 PM ) in
Tech Talk
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 01:21 PM in
Tech Talk
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 01:24 PM (Last edited 07-25-2020 01:24 PM ) in
Tech Talk
- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2020 03:04 PM (Last edited 07-25-2020 03:05 PM ) in
Tech Talk- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2022 03:35 AM in
Tech Talk- Mark as New
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2022 07:10 PM in
Tech TalkHow to hire android developer on budget estimation? Need assistance in hiring an Android developer to build a complex app? Well, you have landed at the right place. Here is a complete guide to hire cost-effective Android developer for your business.
