Format / Wipe Physical Disk
Securely wipe or format a physical disk on the Proxmox host. ProxMenux only shows disks that are fully free (no system use, no guest reference, no mounts) 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: root / swap / system-mounted
├─ Hidden: active ZFS / LVM / RAID members
├─ Hidden: referenced by any VM/LXC config
└─ Shown: fully free disks (⚠ for stale sigs)
│
▼
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)
│
▼
Mode = 4? → extra questions
├─ Filesystem: ext4 / xfs / exfat / btrfs
│ └─ if tool missing (mkfs.btrfs,
│ mkfs.exfat) → abort with hint
└─ Optional label
│
▼
╔════════════════════════════════════╗
║ 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 ┌─────────────────┴─────────────────┐
was changed │ PHASE 2 — Execute │
└─────────────────┬─────────────────┘
▼
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
│
▼
Run the selected mode:
┌─────────────────────────────────┐
│ 1. Wipe all │
│ wipefs -af <disk> │
│ sgdisk --zap-all <disk> │
├─────────────────────────────────┤
│ 2. Remove FS labels │
│ wipefs -af <disk> │
│ + wipefs -af 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 │
│ wipefs -af <disk> │
│ sgdisk --zap-all <disk> │
│ sgdisk -n 1:0:0 -t 1:8300 │
│ <disk> │
│ mkfs.<fs> [-L <label>] │
│ <disk>1 │
└─────────────────────────────────┘
│
▼
Final summary (operation + disk +
bytes touched if applicable)Visibility rules
Before the menu even appears, ProxMenux filters the disk list. Only candidates that are provably safe are shown:
- Shown — disks not used by the host (root pool, swap, mounted, active ZFS/LVM/RAID) and not referenced by any VM/LXC config (running or stopped).
- Hidden — host / system disks.
- Hidden — disks referenced by a VM/LXC config.
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.
- Disks with mounted partitions are hard-blocked at execution (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 | Starting fresh: everything on the disk goes, ready for a new layout. |
| 2. Remove FS labels | Preserved | Preserved | Clears stale ZFS / LVM / RAID signatures so the disk stops being auto-claimed, without touching the data. |
| 3. Zero all data | Preserved | Destroyed (zeroed) | Sanitise before handing the disk over, keeping the existing partition layout. |
| 4. Full format | New GPT | Destroyed | Ready-to-use disk with a single new partition and a fresh filesystem. |
Full format continues with two extra dialogs:
- Filesystem —
ext4,xfs,exfat(portable), orbtrfs. Missing tools (for examplemkfs.btrfs) abort with a clear message. - Label — optional filesystem label for identification.
Step-by-step
Pick a free disk
ProxMenux lists every disk that passes the visibility filters above. Disks with ⚠ markers carry stale metadata and are shown with the details 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.
(Full format only) Pick filesystem and label
ext4 / xfs / exfat / btrfs, plus an optional label.
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.
Re-validation and execution
Just before writing, the script re-checks the disk state. If a partition has been mounted or a VM started in the meantime, execution is aborted. Otherwise the chosen operation runs and a summary is printed at the end.
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) ---
wipefs -af /dev/sdX # clears superblock signatures
# (do NOT run sgdisk --zap-all; it would wipe the partition table)
# --- 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
sgdisk -n 1:0:0 -t 1:8300 /dev/sdX # one partition, Linux filesystem
mkfs.ext4 -L mylabel /dev/sdX1 # pick the fs you wantDisk not listed in the menu
/mnt/tmp), it is an active ZFS / LVM / RAID member, it is referenced by a VM or LXC config, or it is your Proxmox root disk. Run lsblk -f and cat /proc/mdstat 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.