Forrest logo
back to the mkfs.btrfs tool

mkfs.btrfs:tldr:cddcf

mkfs.btrfs: Create a btrfs filesystem on multiple devices with raid1.
$ sudo mkfs.btrfs --metadata raid1 --data raid1 ${-dev-sda} ${-dev-sdb} ${-dev-sdN}
try on your machine

This command is used to format and create a Btrfs filesystem with RAID1 configuration for metadata and data on multiple devices.

Here is the breakdown of the command:

  • sudo: This is a command that allows the user to execute the following command with administrative privileges.
  • mkfs.btrfs: This is the command to format and create a Btrfs filesystem.
  • --metadata raid1: This flag specifies that the metadata (file system structure and information about files) should be stored with RAID1 redundancy. RAID1 mirrors the data on multiple devices to provide data redundancy and improve reliability.
  • --data raid1: This flag states that the actual file data should be stored with RAID1 redundancy as well.
  • ${-dev-sda}, ${-dev-sdb}, ${-dev-sdN}: These are variables representing the device names. Replace -dev-sda, -dev-sdb, and -dev-sdN with the actual device names that you want to use for the Btrfs filesystem. For example, you might replace them with /dev/sda, /dev/sdb, and /dev/sdc if those are the devices you want to include in the RAID1 configuration.

Overall, this command formats and creates a Btrfs filesystem on multiple devices with RAID1 redundancy for both metadata and data, ensuring data integrity and availability.

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