Merge remote-tracking branch internal master
diff --git a/README b/README
index 6566b1c..67c0b43 100644
--- a/README
+++ b/README
@@ -96,6 +96,7 @@
               are the following special values:
 
                 brillo_boot
+                brillo_bootloader
                 brillo_system
                 brillo_odm
                 brillo_oem
@@ -112,6 +113,10 @@
  flags:       A 64-bit integer (decimal or hexadecimal representations are
               accepted) for GPT flags. Default value is 0.
 
+ persist:     If 'true', the parition will be marked persistant. This will
+              set bit 0 of flags to 1. This will OR with the value of
+              'flags'.
+
  ignore:      If 'true', the partition will not be included in the final
               output.
 
diff --git a/bpt_unittest.py b/bpt_unittest.py
index cf9b4f2..3266a7e 100755
--- a/bpt_unittest.py
+++ b/bpt_unittest.py
@@ -365,6 +365,12 @@
                     disk_size=bpttool.ParseSize('10 GiB'),
                     disk_guid='01234567-89ab-cdef-0123-00000000002a')
 
+  def testPersist(self):
+    """Checks that persist flags are generated"""
+    self._MakeTable(['test/persist.bpt'],
+                    'test/expected_json_persist.bpt',
+                    disk_size=bpttool.ParseSize('10 GiB'))
+
   def testSuffixes(self):
     """Checks that A/B-suffixes can be changed on the command-line."""
     self._MakeTable(['test/base.bpt'],
@@ -401,6 +407,12 @@
                     'test/expected_json_stacked_change_flags.bpt',
                     disk_size=bpttool.ParseSize('10 GiB'))
 
+  def testStackedDisableAB(self):
+    """Checks that we can change disable A/B on partitions through stacking."""
+    self._MakeTable(['test/base.bpt', 'test/disable_ab.bpt'],
+                    'test/expected_json_stacked_disable_ab.bpt',
+                    disk_size=bpttool.ParseSize('10 GiB'))
+
   def testStackedNewPartitionOnTop(self):
     """Checks that we can add a new partition only given the output JSON.
 
@@ -496,6 +508,20 @@
             'userdata', 'flags', False),
         '0x0420000000000000')
 
+  def testQueryPersistTrue(self):
+    """Checks query for persist."""
+    self.assertEqual(
+        self.bpt.query_partition(
+            open('test/persist.bpt'),
+            'true_persist', 'persist', False), 'True')
+
+  def testQueryPersistFalse(self):
+    """Checks query for persist."""
+    self.assertEqual(
+        self.bpt.query_partition(
+            open('test/persist.bpt'),
+            'false_persist', 'persist', False), 'False')
+
   def testQuerySizeCollapse(self):
     """Checks query for size when collapsing A/B partitions."""
     self.assertEqual(
diff --git a/bpttool b/bpttool
index cd2b8d5..a29d737 100755
--- a/bpttool
+++ b/bpttool
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 # Copyright 2016, The Android Open Source Project
 #
@@ -30,6 +30,10 @@
 import uuid
 import zlib
 
+# Python 2.6 required for modern exception syntax
+if sys.hexversion < 0x02060000:
+  print >> sys.stderr, "Python 2.6 or newer is required."
+  sys.exit(1)
 
 # Keywords used in JSON files.
 JSON_KEYWORD_SETTINGS = 'settings'
@@ -46,6 +50,7 @@
 JSON_KEYWORD_PARTITIONS_GUID = 'guid'
 JSON_KEYWORD_PARTITIONS_TYPE_GUID = 'type_guid'
 JSON_KEYWORD_PARTITIONS_FLAGS = 'flags'
+JSON_KEYWORD_PARTITIONS_PERSIST = 'persist'
 JSON_KEYWORD_PARTITIONS_IGNORE = 'ignore'
 JSON_KEYWORD_PARTITIONS_AB = 'ab'
 JSON_KEYWORD_PARTITIONS_AB_EXPANDED = 'ab_expanded'
@@ -58,7 +63,8 @@
                          'offset',
                          'guid',
                          'type_guid',
-                         'flags']
+                         'flags',
+                         'persist']
 
 BPT_VERSION_MAJOR = 1
 BPT_VERSION_MINOR = 0
@@ -72,6 +78,7 @@
 
 KNOWN_TYPE_GUIDS = {
     'brillo_boot': 'bb499290-b57e-49f6-bf41-190386693794',
+    'brillo_bootloader': '4892aeb3-a45f-4c5f-875f-da3303c0795c',
     'brillo_system': '0f2778c4-5cc1-4300-8670-6c88b7e57ed6',
     'brillo_odm': 'e99d84d7-2c1b-44cf-8c58-effae2dc2558',
     'brillo_oem': 'aa3434b2-ddc3-4065-8b1a-18e99ea15cb7',
@@ -80,7 +87,8 @@
     'brillo_vbmeta': 'b598858a-5fe3-418e-b8c4-824b41f4adfc',
     'brillo_vendor_specific': '314f99d5-b2bf-4883-8d03-e2f2ce507d6a',
     'linux_fs': '0fc63daf-8483-4772-8e79-3d69d8477de4',
-    'ms_basic_data': 'ebd0a0a2-b9e5-4433-87c0-68b6b72699c7'
+    'ms_basic_data': 'ebd0a0a2-b9e5-4433-87c0-68b6b72699c7',
+    'efi_system': 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b'
 }
 
 
@@ -698,6 +706,8 @@
     type_guid: Type GUID (RFC 4122 compliant) as a string or a known type
                from the |KNOWN_TYPE_GUIDS| map.
     flags: GUID flags.
+    persist: If true, sets bit 0 of flags indicating that this partition should
+             not be deleted by the bootloader.
     ab: If True, the partition is an A/B partition.
     ab_expanded: If True, the A/B partitions have been generated.
     ignore: If True, the partition should not be included in the final output.
@@ -713,6 +723,7 @@
     self.guid = None
     self.type_guid = None
     self.flags = 0
+    self.persist = False
     self.ab = False
     self.ab_expanded = False
     self.ignore = False
@@ -726,36 +737,41 @@
     """
     self.label = pobj[JSON_KEYWORD_PARTITIONS_LABEL]
     value = pobj.get(JSON_KEYWORD_PARTITIONS_OFFSET)
-    if value:
+    if value is not None:
       self.offset = ParseSize(value)
     value = pobj.get(JSON_KEYWORD_PARTITIONS_SIZE)
-    if value:
+    if value is not None:
       self.size = ParseSize(value)
     value = pobj.get(JSON_KEYWORD_PARTITIONS_GROW)
-    if value:
-      self.grow = True
+    if value is not None:
+      self.grow = value
     value = pobj.get(JSON_KEYWORD_PARTITIONS_AB)
-    if value:
+    if value is not None:
       self.ab = value
     value = pobj.get(JSON_KEYWORD_PARTITIONS_AB_EXPANDED)
-    if value:
+    if value is not None:
       self.ab_expanded = value
     value = pobj.get(JSON_KEYWORD_PARTITIONS_GUID)
-    if value:
+    if value is not None:
       self.guid = value
     value = pobj.get(JSON_KEYWORD_PARTITIONS_IGNORE)
-    if value:
+    if value is not None:
       self.ignore = value
     value = pobj.get(JSON_KEYWORD_PARTITIONS_TYPE_GUID)
-    if value:
+    if value is not None:
       self.type_guid = str.lower(str(value))
       if self.type_guid in KNOWN_TYPE_GUIDS:
         self.type_guid = KNOWN_TYPE_GUIDS[self.type_guid]
     value = pobj.get(JSON_KEYWORD_PARTITIONS_FLAGS)
-    if value:
+    if value is not None:
       self.flags = ParseNumber(value)
+    value = pobj.get(JSON_KEYWORD_PARTITIONS_PERSIST)
+    if value is not None:
+      self.persist = value
+      if value:
+        self.flags = self.flags | 0x1
     value = pobj.get(JSON_KEYWORD_PARTITIONS_POSITION)
-    if value:
+    if value is not None:
       self.position = ParseNumber(value)
 
   def expand_guid(self, guid_generator, partition_number):
@@ -975,6 +991,7 @@
               '      "' + JSON_KEYWORD_PARTITIONS_GUID + '": "{}",\n'
               '      "' + JSON_KEYWORD_PARTITIONS_TYPE_GUID + '": "{}",\n'
               '      "' + JSON_KEYWORD_PARTITIONS_FLAGS + '": "{:#018x}",\n'
+              '      "' + JSON_KEYWORD_PARTITIONS_PERSIST + '": {},\n'
               '      "' + JSON_KEYWORD_PARTITIONS_IGNORE + '": {},\n'
               '      "' + JSON_KEYWORD_PARTITIONS_AB + '": {},\n'
               '      "' + JSON_KEYWORD_PARTITIONS_AB_EXPANDED + '": {},\n'
@@ -986,6 +1003,7 @@
                                    p.guid,
                                    p.type_guid,
                                    p.flags,
+                                   'true' if p.persist else 'false',
                                    'true' if p.ignore else 'false',
                                    'true' if p.ab else 'false',
                                    'true' if p.ab_expanded else 'false',
diff --git a/test/disable_ab.bpt b/test/disable_ab.bpt
new file mode 100644
index 0000000..eb1d97e
--- /dev/null
+++ b/test/disable_ab.bpt
@@ -0,0 +1,16 @@
+{
+    "partitions": [
+        {
+            "ab": false,
+            "label": "boot"
+        },
+        {
+            "ab": false,
+            "label": "system"
+        },
+        {
+            "ab": false,
+            "label": "odm"
+        }
+    ]
+}
diff --git a/test/expected_json_alignment.bpt b/test/expected_json_alignment.bpt
index 1996359..f34b9ed 100644
--- a/test/expected_json_alignment.bpt
+++ b/test/expected_json_alignment.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_base.bpt b/test/expected_json_base.bpt
index 189684a..2a135f1 100644
--- a/test/expected_json_base.bpt
+++ b/test/expected_json_base.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_disk_guid.bpt b/test/expected_json_disk_guid.bpt
index 82265e7..9246ebf 100644
--- a/test/expected_json_disk_guid.bpt
+++ b/test/expected_json_disk_guid.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_partitions_offset_begin.bpt b/test/expected_json_partitions_offset_begin.bpt
index bb66b19..4964dab 100644
--- a/test/expected_json_partitions_offset_begin.bpt
+++ b/test/expected_json_partitions_offset_begin.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_persist.bpt b/test/expected_json_persist.bpt
new file mode 100644
index 0000000..0d3b263
--- /dev/null
+++ b/test/expected_json_persist.bpt
@@ -0,0 +1,81 @@
+{
+  "settings": {
+    "ab_suffixes": ["_a", "_b"],
+    "partitions_offset_begin": 0,
+    "disk_size": 10737418240,
+    "disk_alignment": 4096,
+    "disk_guid": "01234567-89ab-cdef-0123-000000000000"
+  },
+  "partitions": [
+    {
+      "label": "no_persist",
+      "offset": 20480,
+      "size": 134217728,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000001",
+      "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
+      "flags": "0x0000000000000000",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 1
+    },
+    {
+      "label": "false_persist",
+      "offset": 134238208,
+      "size": 134217728,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000002",
+      "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
+      "flags": "0x0000000000000000",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 2
+    },
+    {
+      "label": "true_persist",
+      "offset": 268455936,
+      "size": 134217728,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000003",
+      "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
+      "flags": "0x0000000000000001",
+      "persist": true,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 3
+    },
+    {
+      "label": "false_persist_with_flags",
+      "offset": 402673664,
+      "size": 134217728,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000004",
+      "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
+      "flags": "0x0000000000000010",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 4
+    },
+    {
+      "label": "true_persist_with_flags",
+      "offset": 536891392,
+      "size": 134217728,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000005",
+      "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
+      "flags": "0x0000000000000011",
+      "persist": true,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 5
+    }
+  ]
+}
diff --git a/test/expected_json_size.bpt b/test/expected_json_size.bpt
index b72452f..d31ab10 100644
--- a/test/expected_json_size.bpt
+++ b/test/expected_json_size.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_change_ab_size.bpt b/test/expected_json_stacked_change_ab_size.bpt
index be02d8f..0d16099 100644
--- a/test/expected_json_stacked_change_ab_size.bpt
+++ b/test/expected_json_stacked_change_ab_size.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_change_flags.bpt b/test/expected_json_stacked_change_flags.bpt
index 0ae8461..094e4bb 100644
--- a/test/expected_json_stacked_change_flags.bpt
+++ b/test/expected_json_stacked_change_flags.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0420000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_disable_ab.bpt b/test/expected_json_stacked_disable_ab.bpt
new file mode 100644
index 0000000..0558206
--- /dev/null
+++ b/test/expected_json_stacked_disable_ab.bpt
@@ -0,0 +1,67 @@
+{
+  "settings": {
+    "ab_suffixes": ["_a", "_b"],
+    "partitions_offset_begin": 0,
+    "disk_size": 10737418240,
+    "disk_alignment": 4096,
+    "disk_guid": "01234567-89ab-cdef-0123-000000000000"
+  },
+  "partitions": [
+    {
+      "label": "boot",
+      "offset": 20480,
+      "size": 33554432,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000001",
+      "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
+      "flags": "0x0000000000000000",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 0
+    },
+    {
+      "label": "system",
+      "offset": 33574912,
+      "size": 536870912,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000002",
+      "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
+      "flags": "0x0000000000000000",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 0
+    },
+    {
+      "label": "odm",
+      "offset": 570445824,
+      "size": 1073741824,
+      "grow": false,
+      "guid": "01234567-89ab-cdef-0123-000000000003",
+      "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
+      "flags": "0x0000000000000000",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 0
+    },
+    {
+      "label": "userdata",
+      "offset": 1644187648,
+      "size": 9093210112,
+      "grow": true,
+      "guid": "01234567-89ab-cdef-0123-000000000004",
+      "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
+      "flags": "0x0000000000000000",
+      "persist": false,
+      "ignore": false,
+      "ab": false,
+      "ab_expanded": false,
+      "position": 0
+    }
+  ]
+}
diff --git a/test/expected_json_stacked_ignore.bpt b/test/expected_json_stacked_ignore.bpt
index 858162a..9fac092 100644
--- a/test/expected_json_stacked_ignore.bpt
+++ b/test/expected_json_stacked_ignore.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
diff --git a/test/expected_json_stacked_new_partition.bpt b/test/expected_json_stacked_new_partition.bpt
index 0ca2443..5553c60 100644
--- a/test/expected_json_stacked_new_partition.bpt
+++ b/test/expected_json_stacked_new_partition.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
@@ -106,6 +113,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000008",
       "type_guid": "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7",
       "flags": "0x8000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_new_partition_on_top.bpt b/test/expected_json_stacked_new_partition_on_top.bpt
index 79c3fdc..cd1d18e 100644
--- a/test/expected_json_stacked_new_partition_on_top.bpt
+++ b/test/expected_json_stacked_new_partition_on_top.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
@@ -106,6 +113,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000008",
       "type_guid": "0fc63daf-8483-4772-8e79-3d69d8477de4",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_override_settings.bpt b/test/expected_json_stacked_override_settings.bpt
index d1c7b7d..ab40651 100644
--- a/test/expected_json_stacked_override_settings.bpt
+++ b/test/expected_json_stacked_override_settings.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_positions.bpt b/test/expected_json_stacked_positions.bpt
index 0c11be3..8469bec 100644
--- a/test/expected_json_stacked_positions.bpt
+++ b/test/expected_json_stacked_positions.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "314f99d5-b2bf-4883-8d03-e2f2ce507d6a",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "314f99d5-b2bf-4883-8d03-e2f2ce507d6a",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "314f99d5-b2bf-4883-8d03-e2f2ce507d6a",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -106,6 +113,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000008",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -119,6 +127,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000009",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -132,6 +141,7 @@
       "guid": "01234567-89ab-cdef-0123-00000000000a",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_stacked_size.bpt b/test/expected_json_stacked_size.bpt
index eb089da..43837cc 100644
--- a/test/expected_json_stacked_size.bpt
+++ b/test/expected_json_stacked_size.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/expected_json_suffixes.bpt b/test/expected_json_suffixes.bpt
index 1e15d5c..ec50d5d 100644
--- a/test/expected_json_suffixes.bpt
+++ b/test/expected_json_suffixes.bpt
@@ -15,6 +15,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000001",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -28,6 +29,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000002",
       "type_guid": "bb499290-b57e-49f6-bf41-190386693794",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -41,6 +43,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000003",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -54,6 +57,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000004",
       "type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -67,6 +71,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000005",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -80,6 +85,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000006",
       "type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": true,
       "ab_expanded": true,
@@ -93,6 +99,7 @@
       "guid": "01234567-89ab-cdef-0123-000000000007",
       "type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c",
       "flags": "0x0000000000000000",
+      "persist": false,
       "ignore": false,
       "ab": false,
       "ab_expanded": false,
diff --git a/test/persist.bpt b/test/persist.bpt
new file mode 100644
index 0000000..06f39d4
--- /dev/null
+++ b/test/persist.bpt
@@ -0,0 +1,40 @@
+{
+    "partitions": [
+        {
+            "label": "no_persist",
+            "size": "128 MiB",
+            "position": 1,
+            "type_guid": "brillo_boot"
+        },
+        {
+            "label": "false_persist",
+            "size": "128 MiB",
+            "position": 2,
+            "persist": false,
+            "type_guid": "brillo_boot"
+        },
+        {
+            "label": "true_persist",
+            "size": "128 MiB",
+            "position": 3,
+            "persist": true,
+            "type_guid": "brillo_boot"
+        },
+        {
+            "label": "false_persist_with_flags",
+            "size": "128 MiB",
+            "flags": "0x10",
+            "persist": false,
+            "position": 4,
+            "type_guid": "brillo_boot"
+        },
+        {
+            "label": "true_persist_with_flags",
+            "size": "128 MiB",
+            "flags": "0x10",
+            "persist": true,
+            "position": 5,
+            "type_guid": "brillo_boot"
+        }
+    ]
+}