7 Working With a Btrfs root File System
Important:
In Oracle Linux, the Btrfs file system and all the features that are documented in this chapter are supported in the Unbreakable Enterprise Kernel (UEK) release only. Working with Btrfs file system features requires that you boot the system by using UEK R8.
You can create a Btrfs root file system during an installation. To do so, you must boot the system by using UEK R8.
Although Oracle Linux uses the default top level ID set with an ID of 5, the root file system is created as a subvolume within the top level file system on a system that's installed with Btrfs as the root file system. Therefore, when you view the subvolume list, you might see output similar to the following:
ID 256 gen 1591 top level 5 path boot
ID 258 gen 1591 top level 5 path root
ID 259 gen 1514 top level 5 path home
ID 262 gen 1514 top level 258 path var/lib/portables"
In the output, the installation root
file system subvolume has an ID of
258. The subvolume with ID 258 (root
) is mounted as /
. The
default subvolume (root
) with ID 258 is mounted as the active root file
system. For example, the mount
command shows the device that's mounted as
the root
file system and indicates the subvolume ID (258):
Note that the top-level file system isn't mounted by default. To mount the top-level file
system volume, use the subvolid
option to specify the subvolume ID as 5. For
example, you might run:
sudo mount -o subvolid=5 /dev/sda2 /mnt
If you list the contents of /mnt
, you can view each of the subvolumes
within the file system volume, including the root
subvolume.
By setting the default subvolume to use at the root file system and keeping the top-level file system unmounted, we achieve cleaner separation between actively used subvolumes and underlying file system maintenance such as the storage of snapshots.
By mounting the top level file system, you can easily create a snapshot of the root file system. If you need to rollback to a snapshot, you can change the default subvolume for the file system to match the subvolume ID of the snapshot that you want to roll back to.