[pve-devel] [PATCH installer 1/3] zero start of partitions after formatting disk
Fabian Grünbichler
f.gruenbichler at proxmox.com
Thu May 4 09:56:51 CEST 2017
to remove any leftover signatures
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
proxinstall | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/proxinstall b/proxinstall
index 81318fc..26fd655 100755
--- a/proxinstall
+++ b/proxinstall
@@ -825,6 +825,16 @@ sub zfs_create_swap {
return "/dev/zvol/$zfspoolname/swap";
}
+my $udevadm_trigger_block = sub {
+ my ($nowait) = @_;
+
+ sleep(1) if !$nowait; # give kernel time to reread part table
+
+ # trigger udev to create /dev/disk/by-uuid
+ syscmd ("udevadm trigger --subsystem-match block");
+ syscmd ("udevadm settle --timeout 10");
+};
+
sub partition_bootable_disk {
my ($target_dev, $maxhdsize, $ptype) = @_;
@@ -871,6 +881,12 @@ sub partition_bootable_disk {
syscmd($pcmd) == 0 ||
die "unable to partition harddisk '${target_dev}'\n";
+ &$udevadm_trigger_block();
+
+ foreach my $part ($efibootdev, $osdev) {
+ syscmd("dd if=/dev/zero of=$part bs=1M count=256") if -b $part;
+ }
+
return ($os_size, $osdev, $efibootdev);
}
@@ -918,6 +934,10 @@ sub partition_bootable_zfs_disk {
syscmd($pcmd) == 0 ||
die "unable to partition harddisk '${target_dev}'\n";
+ &$udevadm_trigger_block();
+
+ syscmd("dd if=/dev/zero of=$osdev bs=1M count=16") if -b $osdev;
+
return ($os_size, $osdev);
}
@@ -1001,15 +1021,6 @@ sub compute_swapsize {
return $swapsize;
}
-my $udevadm_trigger_block = sub {
- my ($nowait) = @_;
-
- sleep(1) if !$nowait; # give kernel time to reread part table
-
- # trigger udev to create /dev/disk/by-uuid
- syscmd ("udevadm trigger --subsystem-match block");
- syscmd ("udevadm settle --timeout 10");
-};
sub extract_data {
my ($basefile, $targetdir) = @_;
--
2.1.4
More information about the pve-devel
mailing list