Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:default-first-lba
into curtin:master.
Commit message:
block_meta_v2: set first-lba if needed when creating a new GPT
sfdisk sets first-lba to 2048 by default, which fails if one of
the partitions has an start smaller than that. Having a
partition start so early in the disk is a bit strange but it
works if you are preserving a partition (because we preserve
first-lba) so it should probably work when creating one too.
Requested reviews:
curtin developers (curtin-dev)
For more details, see:
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/433618
--
Your team curtin developers is requested to review the proposed merge of
~mwhudson/curtin:default-first-lba into curtin:master.
diff --git a/curtin/commands/block_meta_v2.py b/curtin/commands/block_meta_v2.py
index 348bf89..3c6e1a5 100644
--- a/curtin/commands/block_meta_v2.py
+++ b/curtin/commands/block_meta_v2.py
@@ -227,8 +227,14 @@ class GPTPartTable(SFDiskPartTable):
def _headers(self):
r = []
- if self.first_lba is not None:
- r.extend(['first-lba: ' + str(self.first_lba)])
+ first_lba = self.first_lba
+ if first_lba is None:
+ min_start = min(
+ [entry.start for entry in self.entries], default=2048)
+ if min_start < 2048:
+ first_lba = min_start
+ if first_lba is not None:
+ r.extend(['first-lba: ' + str(first_lba)])
if self.last_lba is not None:
r.extend(['last-lba: ' + str(self.last_lba)])
if self.table_length is not None:
--
Mailing list: https://launchpad.net/~curtin-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~curtin-dev
More help : https://help.launchpad.net/ListHelp