]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Diskmanage.pm
diskmanage: wipe blockdev: also change partition type
[pve-storage.git] / PVE / Diskmanage.pm
index 9d5b037a0bb54c1220de1eaee85d918362d27f23..5041fb393f20670a2c9c94223eb492a41cb52cc8 100644 (file)
@@ -927,6 +927,7 @@ sub change_parttype {
 }
 
 # Wipes all labels and the first 200 MiB of a disk/partition (or the whole if it is smaller).
+# If called with a partition, also sets the partition type to 0x83 'Linux filesystem'.
 # Expected to be called with a result of verify_blockdev_path().
 sub wipe_blockdev {
     my ($devpath) = @_;
@@ -959,6 +960,11 @@ sub wipe_blockdev {
        ['dd', 'if=/dev/zero', "of=${devpath}", 'bs=1M', 'conv=fdatasync', "count=${count}"],
        errmsg => "error wiping '${devpath}'",
     );
+
+    if (is_partition($devpath)) {
+       eval { change_parttype($devpath, '8300'); };
+       warn $@ if $@;
+    }
 }
 
 1;