Forrest logo
back to the mkfs.btrfs tool

mkfs.btrfs:tldr:0334b

mkfs.btrfs: Set a label for the filesystem.
$ sudo mkfs.btrfs --label "${label}" ${-dev-sda} [${-dev-sdN}]
try on your machine

This command is used to create a Btrfs filesystem on a specified storage device or devices. Let's break down the different elements:

  • sudo: It's a command used to run subsequent commands with administrative privileges. It allows the user to execute the following command as a superuser or administrator.

  • mkfs.btrfs: This command is used to create a Btrfs filesystem. It is specific to the Btrfs file system and is responsible for initializing the file system on the specified storage device(s).

  • --label "${label}": This option is used to assign a label to the newly created Btrfs filesystem. The ${label} is a placeholder that would be replaced with the actual desired label. The label serves as a human-readable identifier for the file system.

  • ${-dev-sda} and [${-dev-sdN}]: These placeholders represent the storage device(s) on which the Btrfs filesystem will be created. The -dev-sda denotes the first storage device, and the -dev-sdN represents additional storage devices if desired. Replace ${-dev-sda} and [${-dev-sdN}] with the actual device names, like /dev/sda, /dev/sdb, etc.

Overall, this command allows you to create a Btrfs filesystem on one or more storage devices, with an optional label assigned to it. The system executes it with administrative privileges using sudo.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mkfs.btrfs tool