注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Btrfs

From Funtoo
Jump to navigation Jump to search

BTRFS is a file system based on the copy-on-write (COW) principle, initially designed at Oracle Corporation for use in Linux. The development of Btrfs began in 2007, and since August 2014 the file system's on-disk format has been marked as stable.

In 2015, Btrfs was adopted as the default filesystem for SUSE Linux Enterprise Server 12. SUSE reaffirmed its commitment to Btrfs in 2017 after RedHat announced to stop supporting Btrfs.

Btrfs is intended to address the lack of pooling, snapshots, checksums, and integral multi-device spanning in Linux file systems.

It is easy to set up and use BTRFS. In this simple introduction, we're going to set up BTRFS under Funtoo Linux using an existing debian-sources or debian-sources-lts kernel, like the one that comes pre-built for you with Funtoo Linux, and we will also be using our BTRFS storage pool for storing data that isn't part of the Funtoo Linux installation itself. Funtoo Linux will boot from a non-BTRFS filesystem, and as part of the initialization process will initialize our BTRFS storage pool and mount it at the location of our choice.

Installation

To install BTRFS no aditional steps are needed as it is part of Linux Kernel (in mainline Linux kernel since 2.6.29). Let's emerge the BTRFS userspace tools (btrfs-progs):

root # emerge btrfs-progs

BTRFS is now ready for use.

BTRFS Concepts

BTRFS can be used to manage the physical disks that it uses, and physical disks are added to a BTRFS volume. Then, BTRFS can create subvolumes from the volume on which files can be stored.

Unlike traditional Linux filesystems, BTRFS filesystems will allocate storage on-demand from the underlying volume.

In the BTRFS world, the word volume corresponds to a storage pool (ZFS) or a volume group (LVM).

  • "devices" - one or multiple underlying physical volumes.
  • "volume" - one large storage pool comprised of all space of the devices and can support different redundancy levels
  • subvolumes - these are what get mounted and you store files in.
  • snapshots - a read-only copy of a subvolume at a given point in time and/or read-write copy of a subvolume in time (aka clone).