Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

B Tree File System (BTRFS)

Discussion in 'Filesystem' started by Jarret W. Buse, Aug 13, 2013.

  1. B-Tree File System (BTRFS)

    The B-Tree File System was created by Oracle in 2007. The file system was added to Linux Kernel 2.6.29 in 2009.

    The maximum number of files is 18,446,744,073,709,551,616 or 2 to the 64 power of files. The maximum file length is 255 characters. The theoretical max file size limit is 16 EB, or 8EB because of a kernel limitation in Linux.

    The BTRFS file system helps reduce fragmentation. Storage devices usually show a loss of performance due to fragmentation (usually when fuller). BTRFS does allow for Online Defragmentation.

    To prevent the file system from becoming full, BTRFS supports compression. There are two options for compression: LZO and zlib. The LZO method produces smaller files while zlib compresses faster. To determine which one, mount the BTRFS volume with one of the following:
    · compress=LZO
    · compress=zlib

    When disk space should become full, it is possible to add space to the existing BTRFS volume. The method refers to Online Resize. The BTRFS file system does not need to be unmounted or taken offline. An existing volume can be added, or removed, from the volume to resize the whole file system.

    If a volume has an existing ext3 or ext4 file system, it can be converted to BTRFS. The conversion is an in-place conversion. This means that the existing data does not have to be removed before the file system is converted. It is good practice to perform a backup in case the conversion fails and data is lost.

    BTRFS uses Copy On Write (COW) to handle resources when multiple tasks are using the same data. When an application requests data from a file, the data is sent to memory or cache. Each application then has its own memory space. If multiple applications request the same data, then COW allows for one memory space to be allocated and pointed to by all applications. If one application changes the data, then that application will be given its own memory space with the new updated information. The other applications continue using the older pointers with original data. Using COW requires that the various applications can use older data.

    For redundancy of data, BTRFS supports RAID, specifically: RAID 0, RAID 1 and RAID 10. RAID 0 is for striping data across multiple drives. RAID 0 provides no redundancy, but it does improve performance since multiple hard disks can be read or written to at once. RAID 1 provides redundancy by mirroring the data on two hard disks. When data is created or changed on one drive, it is also done on the other drive. When applications need to read data, it can read from either drive and if one drive is busy, the other can be used so performance is not lost. RAID 10 uses striping across multiple drives which are also mirrored to other drives. RAID 10 provides a greater boost of performance. Data scrubbing can be used, especially with RAID 1 (mirroring). Data scrubbing is a background task that checks data integrity of the file system and repairs any errors. Integrity errors should be fixed before the problem causes serious issues and causes a full scale disk corruption. Data scrubbing can be performed while the volume is mounted.

    There are plans to add RAID 5 in the future. RAID 5 is an extension of RAID 0. In addition to being striped, the data also includes parity. By using parity, RAID 0 is redundant. If one disk in the RAID set fails, the data can be rebuilt on a new disk by using the parity. While the one disk is failed, data from the stripe set can be accessed since the files can be recreated in RAM from the parity. While the system is recreating the files in RAM, the performance will be diminished. Until the disk is replaced, redundancy is no longer in place. If another disk fails, the RAID set is lost and must be restored from a backup.

    If a file system becomes corrupted, such as an improper shutdown, the system can repair itself offline. The BTRFS volume must be unmounted when performing a file system check. The file system check is a fast procedure. Future plans are made to make the file system check and online process.

    Multiple roots can be created by labeling a directory. The directories can be mounted as if they were individual drives. The subvolumes are mounted by the label name.

    To control space consumption, subvolumes can contain Disk Quotas. Disk Quotas can be important to reduce the usage of drive space by users or groups.

    BTRFS allows for read-only Snapshots and read-write clones of subvolumes.

    Diffs can be made of Snapshots and create a binary difference to show the change between the two snapshots. These diffs can then be used to create the snapshot on a different BTRFS file system. The procedure is termed send/receive.

    File system seeding is possible by using the original file system as a read-only copy. Changes made to the files are made to file systems located on separate seed devices. This process uses COW to produce the other copies, if there is more than one seed device.

    Attached Files:

    #1 Jarret W. Buse, Aug 13, 2013
    Last edited: Aug 23, 2013
    2 people like this.
  2. Eric Hansen

    Eric Hansen Guest

    Can you please clarify this:
    There's just a smidge of a difference between 18,446,744,073,709,551,616 and 264.
  3. Sorry about that. It should be 2 to the 64th power. I had a small superscript 64 there, but the RTF codes didn't copy over. I'm glad you caught it. Thanks.
  4. Eric Hansen

    Eric Hansen Guest

    If you copied over from Google Docs (like I do) or anything else then yeah its a bit wonky. No prob though
  5. wenkaizhu

    wenkaizhu Guest

    My English is bad,please use chineses
  6. Paste the article in Google Translator and have it convert the article to your preferred language.

Share This Page