Overview of Virtual A/B

Android has two update mechanisms: A/B (seamless) updates and non-A/B updates. To reduce code complexity and enhance updateability, Android 11 unifies the two mechanisms. The new update mechanism, virtual A/B, combines the advantages of both predecessors by bringing seamless updates to all devices while minimizing the cost of storage.

  • Virtual A/B updates are seamless like A/B updates. Virtual A/B updates minimize the time that a device is offline and unusable.
  • Virtual A/B updates can be rolled back. If the new OS fails to boot, devices automatically roll back to the previous version.
  • Virtual A/B updates use minimum extra space by duplicating only partitions used by the bootloader. Other updateable partitions are snapshotted.


This section explains some terminology and technology that support virtual A/B.


Device-mapper is a Linux virtual block layer used often in Android. With dynamic partitions, partitions like /system are a stack of layered devices:

  • At the bottom of the stack is the physical super partition (for example, /dev/block/by-name/super).
  • In the middle is a dm-linear device, specifying which blocks in the super partition form the given partition. This appears as /dev/block/mapper/system_[a|b] on an A/B device, or /dev/block/mapper/system on a non-A/B device.
  • Finally, a dm-verity device is created for verified partitions. This device verifies that blocks on the dm-linear device are signed correctly. It appears as /dev/block/mapper/system-verity and is the source of the /system mount point.

Here's a diagram of the stack under the /system mount point.

Paritition stacking underneath system

Diagram 1. Stack under the /system mount point

dm-snapshot overview

Virtual A/B relies on dm-snapshot, a device-mapper module for snapshotting the state of a storage device. When using dm-snaphot, there are four devices in play:

  • The base device is the device that is snapshotted. On this page, the base device is always a dynamic partition, such as system or vendor.
  • The copy-on-write (COW) device is used to log changes to the base device. It can be any size, but it must be big enough to accommodate all changes to the base device.
  • The snapshot device is created using the snapshot target. Writes to the snapshot device are written to the COW device. Reads from the snapshot device read either from the base device or the COW device, depending on whether the data being accessed has been changed by the snapshot.
  • The origin device is created using the snapshot-origin target. Reads to the origin device read directly from the base device. Writes to the origin device write directly to the base device, but the original data is backed up by writing to the COW device.

Device mapping for dm-snapshot

Diagram 2. Device mapping for dm-snapshot