mkfs

Linux · System · available in the simulator

What it does

Build a Linux filesystem on a device.

Syntax

mkfs -t tipo dispositivo

Options and parameters

  • -t TIPO

    filesystem type (ext4, vfat, ntfs...)

  • mkfs.TIPO

    shortcut for each filesystem type

  • -t

    Filesystem type to create.

    sudo mkfs -t ext4 /dev/sdb1
  • -L

    Set the volume label for the new filesystem.

  • -n

    Simulate the operation without writing to the disk.

Usage examples

  • sudo mkfs.ext4 /dev/sdb1
  • sudo mkfs.vfat /dev/sdb1
  • sudo mkfs -t ntfs /dev/sdb1
  • mkfs -t ext4 /dev/sdb1
  • sudo mkfs -t ext4 /dev/sdb1

Notes and common mistakes

  • Formatting completely erases the data on the device.
Practise mkfs

Related commands