$linuxjunkies
>

mkfs.btrfs(8)

Create a Btrfs filesystem on one or more block devices.

UbuntuDebianFedoraArch

Synopsis

mkfs.btrfs [OPTION]... [DEVICE]...

Description

mkfs.btrfs creates a new Btrfs filesystem on the specified block devices. Btrfs is a modern copy-on-write (CoW) filesystem with built-in RAID, snapshots, and subvolume support. You can create single-device or multi-device (pooled) filesystems.

All devices must be empty or you must use -f to force creation. The filesystem will be initialized and ready to mount immediately after creation.

Common options

FlagWhat it does
-fForce creation; overwrite existing filesystem without confirmation
-L LABELSet filesystem label (max 256 characters)
-d PROFILEData profile: single, dup, raid0, raid1, raid1c3, raid1c4, raid10 (default: dup for single device, raid1 for multiple)
-m PROFILEMetadata profile: same options as -d (default: dup or raid1)
-M PROFILEMixed data/metadata profile for small filesystems
-n SIZESpecify node size in bytes (default: 16384, must be power of 2)
-s SIZESpecify sector size in bytes (default: 4096)
-U UUIDSet filesystem UUID explicitly (normally auto-generated)
-KKeep IO tree (avoid unnecessary data copies during initialization)
-qSuppress output to stdout

Examples

Create a single-device Btrfs filesystem on /dev/sda1

mkfs.btrfs /dev/sda1

Create filesystem with label 'mydata'

mkfs.btrfs -L mydata /dev/sdb1

Create a 2-device mirrored (RAID1) filesystem across sda1 and sdb1

mkfs.btrfs -d raid1 -m raid1 /dev/sda1 /dev/sdb1

Create a 3-device striped (RAID0) filesystem for maximum capacity

mkfs.btrfs -d raid0 /dev/sda1 /dev/sdb1 /dev/sdc1

Force creation on /dev/sdc1 (overwrites any existing data) with label 'backup'

mkfs.btrfs -f -L backup /dev/sdc1

Create mixed-mode filesystem suitable for small devices with 16KB node size

mkfs.btrfs -M -n 16384 /dev/sdd1

Related commands