diff --git a/cdist/conf/type/__install_reset_disk/gencode-remote b/cdist/conf/type/__install_reset_disk/gencode-remote
index 42ed00c6..a16ded5a 100755
--- a/cdist/conf/type/__install_reset_disk/gencode-remote
+++ b/cdist/conf/type/__install_reset_disk/gencode-remote
@@ -31,6 +31,12 @@ if find /sys/class/block/$disk_name*/holders/ -mindepth 1 | grep -q holders/dm;
    fi
 fi
 
+if command -v pvremove >/dev/null; then
+   pvremove --force --force --yes "$disk" || true
+else
+   echo "WARNING: pvremove command not found" >&2
+fi
+
 # stop mdadm raids if any
 if [ -r /proc/mdstat ]; then
    md_name="\$(awk '/$disk_name/ {print \$1}' /proc/mdstat)"
@@ -43,12 +49,6 @@ if [ -r /proc/mdstat ]; then
       fi
    fi
 fi
-
-if command -v pvremove >/dev/null; then
-   pvremove --force --force --yes "$disk" || true
-else
-   echo "WARNING: pvremove command not found" >&2
-fi
 if command -v mdadm >/dev/null; then
    mdadm --zero-superblock --force "$disk" || true
 else