Creating a Btrfs Layout

Btrfs is a type of file system that is a "copy on write(COW)" system and is internally organized in what is known as a B-Plus tree. It has several features characteristic of a storage device. It is designed to make the file system tolerant of errors, and to facilitate the detection and repair of errors when they occur. It uses checksums to ensure the validity of data and metadata, and maintains snapshots of the file system that can be used for backup or repair.

Creating a Btrfs layout is somewhat similar to the LVM process (described in Creating a Logical Volume Managament (LVM) Layout) with slightly different terminology. A Btrfs volume is the equivalent of an LVM volume group, and a Btrfs subvolume is similar to a LVM logical volume. An important difference to note is how Anaconda reports sizes for separate mount points: For LVM, the exact size of each logical volume is shown next to each mount point in the left pane, while with Btrfs, the total size of the entire volume is shown next to each subvolume.

Warning

Btrfs uses COW. A COW system reads data, allows updates which it writes to a known unused location, and subsequently replaces the Btrfs control information to point to the new location. A conventional system update performs Read from a location and rewite to that same location. Control information is not modified. For some older SSD devices, because of Btrfs’s extra IO, a unforeseen consequence may be shortened SSD life. Newer SSDs are more durable.

Some partition types - notably the /boot and /usr directories and the BIOS Boot and EFI partitions - can not be placed on Btrfs subvolumes. Use standard physical volumes for them (or an LVM logical volume for /usr). See Recommended Partitioning Scheme for more information.

The Manual Partitioning screen
Figure 1. Create Btrfs Subvolume

Follow the procedure below to create Btrfs volumes and subvolumes:

Creating Btrfs Subvolumes and Volumes
  1. Click the + button at the bottom of the list showing existing mount points. A new dialog window will open.

  2. In the new dialog window, specify a mount point for which you want to create a separate logical volume - for example, /. Optionally, specify a size for the volume using standard units such as MB or GB (for example, 50GB). Then, click Add mount point to add the volume and return to the main partitioning screen.

    Note

    When creating a mount point for swap on Btrfs, specify the mount point as swap.

  3. The mount point has now been created using the default settings, which means it has been created as an LVM logical volume. Select the newly created mount point in the left pane to configure it further, and convert it to a Btrfs subvolume by changing the Device Type option to Btrfs. Then, click on Update Settings in the bottom right corner of the screen.

  4. In the Configure Volume dialog, you can change the volume’s name, its RAID level (see Device, File System and RAID Types for information about available RAID types), and you can also specify onto which physical devices (disks) this volume should reside. You can select one or more disks which will be used to hold this volume by holding down kbd:[Ctrl] and clicking each disk in the list.

    Note

    If you select a redundant RAID type (such as RAID1 (Redundancy)), the volume will take up twice its actual size on your disks. A 5 GB volume with RAID1 will take up 10 GB of space.

    Additionally, you can set a fixed size for the volume by selecting the Fixed option from the Size policy menu and entering a size for the volume group.

    After you have configured the Btrfs volume settings, click Save to return to the main Manual Partitioning screen.

  5. If you need to create more than one Btrfs volume, open the Volume drop-down menu and select the Create a new volume group option. A new dialog window will open, identical to the one described in the previous step. Again, select a name, storage devices, encryption settings, RAID level and size policy for the new volume, and click Save. The new volume will then become available in the Volume Group drop-down menu; you can then go through your existing mount points and change this setting to assign them to a different volume.

  6. Configure other settings specific to the subvolume - its Mount Point, Desired Capacity, File System, and Name. Press Update Settings to apply any changes to the configuration.

Repeat this procedure for any additional Btrfs subvolumes you want to create. Note that when creating additional subvolumes, a new volume is not automatically created each time; instead, any additional subvolumes are assigned to an existing volume.

For each mount point you create, review its settings and make sure that it is assigned to the correct volume, that it has sufficient capacity, and that it has a descriptive name so you can identify the subvolume later if you need to.