]> git.proxmox.com Git - pve-storage.git/commit - PVE/Diskmanage.pm
diskmanage: add wipe_blockdev method
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 23 Apr 2021 10:14:51 +0000 (12:14 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 2 Jun 2021 09:56:51 +0000 (11:56 +0200)
commit262ad7a92e91c9d0ed883347ae4fa475744293aa
tree17f6daf0d2f5157614a74afa6cac3c6880aaf93d
parent6f966017d09f9c71f92e41d46434bff69fb1d3ae
diskmanage: add wipe_blockdev method

based on the wipe_disks method from pve-manager's Ceph/Tools.pm with the
following main differences:
    * use wipefs to wipe labels first (to avoid sgdisk complaining about the
      backed up GPT structure on a subsequent GPT initialization)
    * only take one device as an argument
    * do not use an absolute path for 'dd'
    * die if one of the command fails

The wipefs command makes checks and complains about e.g. mounted or active
devices. One could supply --force to wipefs, but in many such situations it
does not work as expected, because the device would still be detected as in-use
afterwards, and further manaual steps would be needed.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Diskmanage.pm