• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mkfs.btrfs Command Examples in Linux

by Deepika

mkfs.btrfs is a utility used to create a Btrfs (short for “B-tree file system”) file system on a storage device. By default, mkfs.btrfs creates a RAID1 file system, meaning that data is stored in two identical copies, each located on a separate storage device. This provides data redundancy, allowing the file system to continue functioning even if one of the storage devices fails. The RAID1 layout is specified with the -d raid1 option, and it can be changed to other Btrfs RAID levels (e.g. RAID0, RAID10) if desired. Note that creating a Btrfs file system requires unmounting the target device, and all existing data on the device will be destroyed.

mkfs.btrfs Command Examples

1. Create a btrfs filesystem on a single device:

# sudo mkfs.btrfs --metadata single --data single /dev/sda

2. Create a btrfs filesystem on multiple devices with raid1:

# sudo mkfs.btrfs --metadata raid1 --data raid1 /dev/sda /dev/sdb /dev/sdN

3. Set a label for the filesystem:

# sudo mkfs.btrfs --label "label" /dev/sda [/dev/sdN]

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to take mailbox backup of Zimbra Account from CLI
  2. edgepaint: Colorize edges of a graph layout to clarify crossing edges
  3. “gitlab-ctl” Command Examples
  4. qtile Command Examples in Linux
  5. ibmcloud Command Examples
  6. helm Command Examples
  7. What causes iptables to load every time after a reboot even when it’s completely turned off
  8. gitlint Command Examples
  9. pacman-key: command not found
  10. lsscsi Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright