mkfs Command Generator
Generate mkfs commands to build a Linux filesystem on a block device
Getting Started with mkfs
## What is mkfs?
The `mkfs` command builds a filesystem on a block device (a partition or disk). It is the Linux tool for formatting a partition so the kernel can mount it. Without a filesystem, a device cannot hold files.
## How to Use
1. **Pick the Filesystem Type**: Choose the type to create (ext4 by default; also xfs, btrfs, ntfs, vfat). 2. **Set the Device**: Enter the block device to format (e.g., `/dev/sda1`). 3. **Add Checks** (optional): Enable `-c` to scan for bad blocks first, `-v` for verbose output. 4. **Copy & Run**: Paste the generated command into your terminal. `mkfs` formats the device — all existing data on it will be lost.
Common Options
### `-t type` Filesystem type
Selects the filesystem to build: `ext4` (default), `xfs`, `btrfs`, `ntfs`, or `vfat`. When ext4 is selected, the `-t` flag is omitted for brevity; other types emit `-t <type>`.
### Device (positional, required)
The block device to format, e.g., `/dev/sda1`. This must be a partition device, not a mount point.
### `-c` Check bad blocks
Read the device for bad blocks before formatting. Slower but safer for older or suspect media.
### `-v` Verbose
Print detailed progress while the filesystem is being created.
### `-V` Version
Print the mkfs version and exit (no formatting happens).
▶Is mkfs dangerous?
▶How do I format a USB stick as ext4?
▶Which filesystem type should I choose?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee