Format / Wipe Physical Disk
Securely wipe or format a physical disk on the Proxmox host. ProxMenux hides system disks, warns about any other use before you confirm, blocks disks used by a running VM or CT, and forces a double confirmation (yes/no plus typing the full disk path) before destroying any data.
Destructive tool
How the script runs
The flow has two phases with a triple-gate safety filter in between. The disk list, the operation mode and the file system details are all collected in Phase 1; nothing is written until Phase 2 passes a final re-validation right before executing.
┌─────────────────────────────────────────────┐
│ PHASE 1 — Filter, choose, confirm │
│ (nothing touched yet) │
└──────────────────┬──────────────────────────┘
▼
Detect disks on host (lsblk)
│
▼
Visibility filter
├─ Hidden: system mount / swap / root pool
├─ Shown, blocked: used by a running VM/CT
└─ Shown with warning: stopped guest ref,
data mounts, ZFS / LVM / RAID members
│
▼
User picks a disk
│
▼
Operation mode
├─ 1. Wipe all (partitions + sigs)
├─ 2. Remove FS labels (data preserved)
├─ 3. Zero all data (partitions kept)
└─ 4. Full format (new GPT + mkfs)
│
▼
╔════════════════════════════════════╗
║ Double confirmation gate ║
║ (1) yes/no dialog with summary ║
║ (2) type the full disk path exactly║
║ (e.g. /dev/sdc) ║
║ Any mismatch → abort ║
╚══════════════════╤═════════════════╝
│
┌──────── Cancel OR Confirm ────┐
▼ ▼
Exit, nothing Mode = 4? → Filesystem:
was changed ext4 / xfs / exfat / btrfs / zfs
(zfs → also asks the pool name)
│
┌────────────────┴──────────────────┐
│ PHASE 2 — Execute │
└─────────────────┬─────────────────┘
▼
Mode 4: install exfatprogs if
mkfs.exfat is missing; abort if
mkfs.btrfs is missing
│
▼
Pre-execution re-validation
(state may have changed since
Phase 1 — user just confirmed)
├─ Disk now hosts system mount?
│ → hard block, abort
├─ Disk now in root ZFS pool?
│ → hard block, abort
├─ Disk has active swap?
│ → hard block, abort
├─ Data partitions still mounted?
│ → auto-unmount; abort if fails
├─ Active ZFS pool on the disk?
│ → zpool export
└─ Used by a running VM/CT?
→ hard block, abort
│
▼
Run the selected mode:
┌─────────────────────────────────┐
│ 1. Wipe all │
│ wipefs -af each partition │
│ sgdisk --zap-all <disk> │
│ blkdiscard (if supported) │
│ zero first + last 16 MiB │
├─────────────────────────────────┤
│ 2. Remove FS labels │
│ wipefs -af --types <fs/raid> │
│ <disk> + each partition │
│ (partition table PRESERVED) │
├─────────────────────────────────┤
│ 3. Zero all data │
│ For each partition: │
│ dd if=/dev/zero of=<part> │
│ bs=4M │
│ (partition table PRESERVED) │
├─────────────────────────────────┤
│ 4. Full format │
│ same wipe as mode 1 │
│ parted mklabel gpt │
│ parted mkpart 1MiB 100% │
│ mkfs.<fs> <disk>1 │
│ (zfs: zpool create <pool>) │
└─────────────────────────────────┘Visibility rules
Before the menu appears, ProxMenux filters the disk list. Only system disks are hidden; any other use is shown so you can decide:
- Hidden: disks with a system mount (
/,/boot,/usr,/var…), an active swap partition or a member of the ZFS root pool, plus read-only devices. - Shown, blocked at confirmation: disks referenced by a running VM or CT.
- Shown with a warning: disks referenced by a stopped VM or LXC config, disks with mounted data partitions, and active ZFS / LVM / RAID members.
Safety at confirmation and execution
- Disks with stale / active metadata show detailed warnings before you confirm.
- Disks used by a running VM are hard-blocked at confirmation.
- Mounted data partitions are unmounted automatically at execution and any active ZFS pool on the disk is exported. If a partition cannot be unmounted, execution aborts (a fresh re-validation runs right before anything is written).
- Two confirmations are always required: yes/no dialog + typing the full disk path exactly.
Operation modes
After picking a disk you choose one of four modes. They differ in what they destroy and what they leave behind:
| Mode | Partition table | Data | Use case |
|---|---|---|---|
| 1. Wipe all | Destroyed | Signatures wiped | Removes the partition table and the filesystem and RAID metadata, zeroes the first and last 16 MiB and, on drives that support discard, trims the whole disk. The rest of the data is not overwritten and may still be recoverable on HDDs; this is not a secure erase. |
| 2. Remove FS labels | Preserved | Preserved | Removes stale ZFS / LVM / RAID signatures so the disk is no longer auto-claimed. Bulk user data is not overwritten, but removing signatures can make it inaccessible. |
| 3. Zero all data | Preserved | Destroyed (zeroed) | Overwrite the existing partitions with zeros while keeping the partition table. Unallocated space and SSD spare areas are not covered; this is not a complete device sanitization guarantee. |
| 4. Full format | New GPT | Destroyed | Ready-to-use disk with a single new partition and a fresh filesystem or ZFS pool. |
Full format asks one more question after the confirmation:
- Filesystem:
ext4,xfs,exfat(portable),btrfsorzfs. Ifmkfs.exfatis missing, ProxMenux installsexfatprogs; ifmkfs.btrfsis missing, it aborts with a hint. - ZFS pool name (ZFS only): suggested as
pool_<disk>. The pool is created withashift=12andlz4compression.
Step-by-step
Pick a free disk
ProxMenux lists every disk that passes the visibility filter above, with its model and size. Any metadata found on the disk (ZFS / LVM / RAID signatures, mounted partitions, guest references) is shown in the confirmation summary so you know what you are about to overwrite.
Pick an operation mode
Choose between Wipe all, Remove FS labels, Zero all data or Full format according to the table above.
Confirm twice
ProxMenux shows a summary of what will happen. You accept with a yes/no dialog and type the full disk path exactly as shown (for example /dev/sdc). Anything else aborts.
(Full format only) Pick the filesystem
ext4 / xfs / exfat / btrfs / zfs. For ZFS, also the pool name.
Re-validation and execution
Just before writing, the script re-checks the disk state. It aborts if the disk now holds a system mount, an active swap partition or a ZFS root pool member, or if a running VM or CT uses it. Mounted data partitions are unmounted and active ZFS pools on the disk are exported. Then the chosen operation runs.
Manual equivalents
If you prefer to run the equivalent commands by hand:
# --- mode 1: wipe all (partition table + signatures) ---
wipefs -af /dev/sdX
sgdisk --zap-all /dev/sdX
# --- mode 2: remove FS labels only (keep partitions + data) ---
# --types limits wipefs to filesystem/RAID signatures; without it,
# wipefs -af on the disk would also erase the partition table
types=$(blkid -k | paste -sd,)
wipefs -af --types "$types" /dev/sdX /dev/sdX?*
# --- mode 3: zero all data (keep partition table) ---
for p in /dev/sdX?*; do
dd if=/dev/zero of="$p" bs=4M status=progress || true
done
# --- mode 4: full format (new GPT + filesystem) ---
wipefs -af /dev/sdX
sgdisk --zap-all /dev/sdX
parted -s /dev/sdX mklabel gpt mkpart primary 1MiB 100% # one partition
mkfs.ext4 /dev/sdX1 # pick the fs you wantDisk not listed in the menu
/, /boot, /usr, /var…), an active swap partition or a member of the ZFS root pool, or a read-only device. Data mounts, guest references and ZFS / LVM / RAID membership do not hide a disk. Run lsblk -f, swapon --show and zpool status on the host to understand why."Disk may be busy" / unmount failed
lsof | grep /dev/sdX or fuser -vm /dev/sdX1, stop it, then re-run the tool.Related
- SMART Disk Health & Test — check a disk before / after wiping to confirm it's healthy.
- Import Disk to VM — pass a freshly-formatted disk to a VM.
- Add local disk as Proxmox storage — register a wiped disk as a Proxmox storage pool.
- Storage and Disks commands — lsblk, blkid, parted reference.
- Disk Manager overview.