Mageia Bugzilla – Attachment 8956 Details for
Bug 20161
On non-GPT disk an empty partition is created when diskdrake does the partitioning, because it mistakenly thinks a BIOS boot partition is needed.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Patch to fix auto-allocation of BIOS boot partitions
0009-Fix-auto-allocation-of-BIOS-boot-partitions-mga-2016.patch (text/plain), 3.31 KB, created by
Martin Whitaker
on 2017-02-13 10:01:32 CET
(
hide
)
Description:
Patch to fix auto-allocation of BIOS boot partitions
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2017-02-13 10:01:32 CET
Size:
3.31 KB
patch
obsolete
>From 02ba0f311a04e3fe93985bb75b6e7e99c6315b73 Mon Sep 17 00:00:00 2001 >From: Martin Whitaker <mageia@martin-whitaker.me.uk> >Date: Sat, 4 Feb 2017 23:46:14 +0000 >Subject: [PATCH 09/14] Fix auto-allocation of BIOS boot partitions (mga#20161, > mga#19888). > >This adds a specific subroutine, fsedit::auto_allocate_boot_bios_parts >that detects if a BIOS boot partition is needed and allocates it if so. >This allows us to relax the rules in fs::any::is_boot_bios_part_needed >to allow the user to manually allocate the BIOS boot partition on a >different device if they so wish. > >In the normal case that installation is confined to a single disk, >this will allocate a single BIOS boot partition on that disk. In >the rare case that installation is spread over multiple disks, it >will allocate a BIOS boot partition on every disk. Given that the >BIOS boot partitions are very small and that this is not a normal >use case (see mga#16055), this seems an acceptable quirk - and does >allow the user to then choose any disk when installing the boot >loader. > >diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm >index 114039b..03c73bd 100644 >--- a/perl-install/fsedit.pm >+++ b/perl-install/fsedit.pm >@@ -56,9 +56,6 @@ sub init_mntpnt_suggestions { > if (!any { isESP($_) } @$fstab) { > $mntpoint = { mntpoint => "/boot/EFI", size => MB(100), pt_type => 0xef, ratio => 1, maxsize => MB(300) }; > } >- } elsif (fs::any::is_boot_bios_part_needed($all_hds, $fstab)) { >- # suggests a Boot BIOS partition if none is present and if needed (aka !UEFI but disk is GPT partitionned) >- $mntpoint = { mntpoint => "", size => MB(1), pt_type => 'BIOS_BOOT', ratio => 1, maxsize => MB(2) }; > } > return if !$mntpoint; > foreach (keys %suggestions) { >@@ -518,6 +515,8 @@ sub auto_allocate { > my ($all_hds, $o_suggestions, $o_target) = @_; > my $before = listlength(fs::get::fstab($all_hds)); > >+ auto_allocate_bios_boot_parts($all_hds, $o_target) if !is_uefi(); >+ > my $suggestions = $o_suggestions || $suggestions{simple}; > allocatePartitions($all_hds, $suggestions, $o_target); > >@@ -545,6 +544,22 @@ sub auto_allocate { > fs::mount_point::suggest_mount_points_always(\@fstab); > } > >+sub auto_allocate_bios_boot_parts { >+ my ($all_hds, $o_hd) = @_; >+ foreach my $hd (@{$all_hds->{hds}}) { >+ # skip if not the selected device >+ next if $o_hd && ($o_hd->{device} ne $hd->{device}); >+ # skip non-GPT disks >+ next if ($hd->{pt_table_type} || partition_table::default_type($hd)) ne 'gpt'; >+ # check if a BIOS boot partition already exists >+ my @parts = map { partition_table::get_normal_parts($_) } $hd; >+ next if any { isBIOS_GRUB($_) } @parts; >+ # try to allocate a BIOS boot partition >+ $suggest = { mntpoint => "", size => MB(1), pt_type => 'BIOS_GRUB', ratio => 1, maxsize => MB(2) }; >+ allocatePartitions($all_hds, [ $suggest ], $hd); >+ } >+} >+ > sub auto_allocate_raids { > my ($all_hds, $suggestions) = @_; > >diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm >index f0cfc0e..4b357ab 100644 >--- a/perl-install/partition_table.pm >+++ b/perl-install/partition_table.pm >@@ -310,6 +310,7 @@ sub read_primary { > bless $hd, "partition_table::$_"; > if ($hd->read_primary) { > log::l("found a $_ partition table on $hd->{file} at sector 0"); >+ $hd->{pt_table_type} = $_ if $_ ne 'empty'; > return 1; > } > } >-- >2.10.2 >
From 02ba0f311a04e3fe93985bb75b6e7e99c6315b73 Mon Sep 17 00:00:00 2001 From: Martin Whitaker <mageia@martin-whitaker.me.uk> Date: Sat, 4 Feb 2017 23:46:14 +0000 Subject: [PATCH 09/14] Fix auto-allocation of BIOS boot partitions (mga#20161, mga#19888). This adds a specific subroutine, fsedit::auto_allocate_boot_bios_parts that detects if a BIOS boot partition is needed and allocates it if so. This allows us to relax the rules in fs::any::is_boot_bios_part_needed to allow the user to manually allocate the BIOS boot partition on a different device if they so wish. In the normal case that installation is confined to a single disk, this will allocate a single BIOS boot partition on that disk. In the rare case that installation is spread over multiple disks, it will allocate a BIOS boot partition on every disk. Given that the BIOS boot partitions are very small and that this is not a normal use case (see mga#16055), this seems an acceptable quirk - and does allow the user to then choose any disk when installing the boot loader. diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 114039b..03c73bd 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -56,9 +56,6 @@ sub init_mntpnt_suggestions { if (!any { isESP($_) } @$fstab) { $mntpoint = { mntpoint => "/boot/EFI", size => MB(100), pt_type => 0xef, ratio => 1, maxsize => MB(300) }; } - } elsif (fs::any::is_boot_bios_part_needed($all_hds, $fstab)) { - # suggests a Boot BIOS partition if none is present and if needed (aka !UEFI but disk is GPT partitionned) - $mntpoint = { mntpoint => "", size => MB(1), pt_type => 'BIOS_BOOT', ratio => 1, maxsize => MB(2) }; } return if !$mntpoint; foreach (keys %suggestions) { @@ -518,6 +515,8 @@ sub auto_allocate { my ($all_hds, $o_suggestions, $o_target) = @_; my $before = listlength(fs::get::fstab($all_hds)); + auto_allocate_bios_boot_parts($all_hds, $o_target) if !is_uefi(); + my $suggestions = $o_suggestions || $suggestions{simple}; allocatePartitions($all_hds, $suggestions, $o_target); @@ -545,6 +544,22 @@ sub auto_allocate { fs::mount_point::suggest_mount_points_always(\@fstab); } +sub auto_allocate_bios_boot_parts { + my ($all_hds, $o_hd) = @_; + foreach my $hd (@{$all_hds->{hds}}) { + # skip if not the selected device + next if $o_hd && ($o_hd->{device} ne $hd->{device}); + # skip non-GPT disks + next if ($hd->{pt_table_type} || partition_table::default_type($hd)) ne 'gpt'; + # check if a BIOS boot partition already exists + my @parts = map { partition_table::get_normal_parts($_) } $hd; + next if any { isBIOS_GRUB($_) } @parts; + # try to allocate a BIOS boot partition + $suggest = { mntpoint => "", size => MB(1), pt_type => 'BIOS_GRUB', ratio => 1, maxsize => MB(2) }; + allocatePartitions($all_hds, [ $suggest ], $hd); + } +} + sub auto_allocate_raids { my ($all_hds, $suggestions) = @_; diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index f0cfc0e..4b357ab 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -310,6 +310,7 @@ sub read_primary { bless $hd, "partition_table::$_"; if ($hd->read_primary) { log::l("found a $_ partition table on $hd->{file} at sector 0"); + $hd->{pt_table_type} = $_ if $_ ne 'empty'; return 1; } } -- 2.10.2
View Attachment As Raw
Actions:
View
Attachments on
bug 20161
:
8884
|
8885
|
8896
|
8897
|
8929
|
8930
|
8931
|
8932
| 8956 |
8957