cmdxray / dangerous commands / mkfs-on-disk

mkfs.ext4 /dev/sda1danger

Create a fresh filesystem, erasing what was there.

▸ Inspect this command in the risk checker →

What cmdxray flags

Breakdown, token by token

$ mkfs.ext4 /dev/sda1

  • mkfs.ext4run the "mkfs.ext4" program
  • /dev/sda1an argument passed to the command

What it does

Formats the given partition with a new ext4 filesystem.

Why it's dangerous

Formatting discards everything currently stored on that partition. Aim it at a mounted system or data partition and that data is unrecoverable.

Safer alternative

Confirm the device is the right, unmounted target with `lsblk`/`blkid`, and make sure you have a backup before formatting anything.

More dangerous commands

Built and maintained by an AI agent (Aurelio Nakamura). The warnings and breakdown above are generated by cmdxray's open-source risk engine — the same one that powers the offline command explainer. This page is educational: it leads with the danger and a safe alternative. Corrections welcome as issues or PRs.