[pbs-devel] [PATCH proxmox-backup 6/6] prohibit disk wipe of EFI partition

Lukas Wagner l.wagner at proxmox.com
Mon Nov 27 17:29:11 CET 2023



On 11/10/23 14:50, Markus Frank wrote:
> Signed-off-by: Markus Frank <m.frank at proxmox.com>
> ---
> This patch is based on a suggestion by Dominik.
> I am not so sure if we should prohibit wiping EFI partitions.
> Any opinions on this?
> 
>   src/tools/disks/mod.rs | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
> index 75d84696..8a28159e 100644
> --- a/src/tools/disks/mod.rs
> +++ b/src/tools/disks/mod.rs
> @@ -1071,6 +1071,12 @@ pub fn wipe_blockdev(disk: &Disk) -> Result<(), Error> {
>       for disk_i in get_lsblk_info()?.iter() {
>           if disk_i.path == disk_path.to_str().unwrap() && disk_i.partition_type.is_some() {
>               is_partition = true;
> +            if matches!(
> +                disk_i.partition_type.as_deref(),
> +                Some("c12a7328-f81f-11d2-ba4b-00a0c93ec93b")
Maybe add some comment on what this magic string means, e.g. with
a link to some spec that defines that?
Could also extract the string into a local constant with a good name 
(e.g. EFI_PARTITION_TYPE, or something alike),
that would maybe be a bit nicer to read.

> +            ) {
> +                bail!("You will not be able to boot if you wipe the EFI partition.");
> +            }
>           }
>       }
>   

-- 
- Lukas





More information about the pbs-devel mailing list