]> git.proxmox.com Git - pve-installer.git/commitdiff
wipe partitiontable after early exits
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 27 Nov 2019 16:06:58 +0000 (17:06 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Nov 2019 18:17:26 +0000 (19:17 +0100)
by wiping the partition table after the initial sanity checks regarding
minimal size and blocksize of the device, no data is destroyed for an
install that would fail in any case.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
proxinstall

index f8bef528ce09bd520aa7e9fb57a5abfeb07fdb5b..7873acea66c0e3037fdeb2cf1a856d50e2dc34af 100755 (executable)
@@ -937,7 +937,6 @@ sub partition_bootable_disk {
     die "unknown partition type '$ptype'"
        if !($ptype eq '8E00' || $ptype eq '8300' || $ptype eq 'BF01');
 
     die "unknown partition type '$ptype'"
        if !($ptype eq '8E00' || $ptype eq '8300' || $ptype eq 'BF01');
 
-    syscmd("sgdisk -Z ${target_dev}");
     my $hdsize = hd_size($target_dev); # size in KB (1024 bytes)
 
     my $restricted_hdsize_mb = 0; # 0 ==> end of partition
     my $hdsize = hd_size($target_dev); # size in KB (1024 bytes)
 
     my $restricted_hdsize_mb = 0; # 0 ==> end of partition
@@ -952,6 +951,8 @@ sub partition_bootable_disk {
     my $hdgb = int($hdsize/(1024*1024));
     die "hardisk '$target_dev' too small (${hdgb}GB)\n" if $hdgb < 8;
 
     my $hdgb = int($hdsize/(1024*1024));
     die "hardisk '$target_dev' too small (${hdgb}GB)\n" if $hdgb < 8;
 
+    syscmd("sgdisk -Z ${target_dev}");
+
     # 1 - BIOS boot partition (Grub Stage2): first free 1M
     # 2 - EFI ESP: next free 512M
     # 3 - OS/Data partition: rest, up to $maxhdsize in MB
     # 1 - BIOS boot partition (Grub Stage2): first free 1M
     # 2 - EFI ESP: next free 512M
     # 3 - OS/Data partition: rest, up to $maxhdsize in MB