Forrest logo
back to the mkfs.btrfs tool

mkfs.btrfs:tldr:b33fd

mkfs.btrfs: Create a btrfs filesystem on a single device.
$ sudo mkfs.btrfs --metadata single --data single ${-dev-sda}
try on your machine

This command is used to create a Btrfs (B-tree file system) on a specific device. Let's break it down:

  • sudo: It runs the command with administrative privileges. This may require entering your password.
  • mkfs.btrfs: It is the command to create a Btrfs file system.
  • --metadata single: This flag specifies that the metadata of the file system should be stored with a single copy. In Btrfs, metadata refers to the system's structural information.
  • --data single: This flag specifies that the data should be stored with a single copy. Data refers to the actual content and files stored in the file system.
  • ${-dev-sda}: This is the path to the device, in this case, it is assuming the device is /dev/sda. The dollar sign and curly brackets are used to reference the value of the variable, but it seems like there is a typo with the dash. It should be /dev/sda instead of ${-dev-sda}.

By using this command, you will create a Btrfs file system on the specified device (/dev/sda in this case) with both metadata and data stored with a single copy.

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