Product SiteDocumentation Site

A.2.3. btrfs (optional) - Create Btrfs Volume or Subvolume

Create a Btrfs volume or subvolume. For a volume, the syntax is:
btrfs mntpoint --data=level --metadata=level [--label=] partitions
One or more partitions can be specified in partitions. When specifying more than one partitions, the entries must be separated by a single space. See Example A.1, “Creating Btrfs Volumes and Subvolumes” for a demonstration.
For a subvolume, the syntax is:
btrfs mntpoint --subvol --name=name parent
parent should be the identifier of the subvolume's parent volume, name with a name for the subvolume, and mntpoint is the location where the file system is mounted.
--data=
RAID level to use for file system data (such as 0, 1, or 10). This parameter is optional, has no meaning for subvolumes, and requires more than one physical disk.
--metadata=
RAID level to use for file system/volume metadata (such as 0, 1, or 10). This parameter is optional, has no meaning for subvolumes, and requires more than one physical disk.
--label=
Specify a label for the Btrfs file system. If the given label is already in use by another file system, a new label will be created. This option has no meaning for subvolumes.
--subvol
Create a Btrfs subvolume instead of a volume.
--name=
Set a name for a Btrfs subvolume.
--noformat or --useexisting
Use an existing Btrfs volume (or subvolume) and do not reformat the file system.
--mkfsoptions=
Specifies additional parameters to be passed to the program that makes a filesystem on this volume or subvolume. No processing is done on the list of arguments, so they must be supplied in a format that can be passed directly to the mkfs program. This means multiple options should be comma-separated or surrounded by double quotes, depending on the filesystem.
The following example shows how to create a Btrfs volume from member partitions on three disks with subvolumes for / and /home. The main volume is not mounted or used directly in this example.
Example A.1. Creating Btrfs Volumes and Subvolumes
part btrfs.01 --size=6000 --ondisk=sda
part btrfs.02 --size=6000 --ondisk=sdb
part btrfs.03 --size=6000 --ondisk=sdc

btrfs none --data=0 --metadata=1 --label=f24 btrfs.01 btrfs.02 btrfs.03
btrfs / --subvol --name=root LABEL=f24
btrfs /home --subvol --name=home f24