[pve-devel] [PATCH v2 storage 3/3] Fix #2550: Wipe disk before creating a directory

Dominic Jäger d.jaeger at proxmox.com
Tue Feb 25 11:28:38 CET 2020


Some leftovers are not detected by our "is disk in use" checks.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
v1->v2: Use new wipefs parameter
 PVE/API2/Disks/Directory.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PVE/API2/Disks/Directory.pm b/PVE/API2/Disks/Directory.pm
index 2decb89..1063fe1 100644
--- a/PVE/API2/Disks/Directory.pm
+++ b/PVE/API2/Disks/Directory.pm
@@ -212,6 +212,9 @@ __PACKAGE__->register_method ({
 	    my $mountunitpath = "/etc/systemd/system/$mountunitname";
 
 	    PVE::Diskmanage::locked_disk_action(sub {
+		# Leftovers might thwart partitioning
+		PVE::Diskmanage::wipe_blockdevices([$dev], {wipefs=>1});
+
 		# create partition
 		my $cmd = [$SGDISK, '-n1', '-t1:8300', $dev];
 		print "# ", join(' ', @$cmd), "\n";
-- 
2.20.1



More information about the pve-devel mailing list