Table of Contents

B-TREE FS

BTRFS for Linux

Install

apt-get install btrfs-progs
echo "btrfs" >> /etc/modules
reboot

Setup

Create a disk partition using gdisk

gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 7814037167 sectors, 3.6 TiB
Model: Portable
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): ED98F650-DC25-46BC-9D36-FCE4C20783C4
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 7814037133
Partitions will be aligned on 2048-sector boundaries
Total free space is 7811939948 sectors (3.6 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2099199   1024.0 MiB  8300  Linux filesystem

Format partition

mkfs.btrfs -f /dev/sda1
btrfs-progs v5.10.1
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               4ec8fe62-e6a2-432d-8fec-7eaf1e4bed19
Node size:          16384
Sector size:        4096
Filesystem size:    1.00GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP              51.19MiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Runtime features:
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1     1.00GiB  /dev/sda1

Mount partition

mkdir /mnt/1
mount /dev/sda1 /mnt/1
df -h /mnt/1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       1.0G  3.5M  905M   1% /mnt/1

dmesg

BTRFS: device fsid 4ec8fe62-e6a2-432d-8fec-7eaf1e4bed19 devid 1 transid 5 /dev/sda1 scanned by mkfs.btrfs (768)
BTRFS info (device sda1): using crc32c (crc32c-generic) checksum algorithm
BTRFS info (device sda1): disk space caching is enabled
BTRFS info (device sda1): checking UUID tree

fstab

UUID=f6eb5f98-032e-4634-b726-24f356c17af8 /opt btrfs noatime,nodiratime 0 0
mount -a
systemctl daemon-reload