Getting started

From btrfs Wiki
Revision as of 18:23, 6 November 2008 by Lagalopex (Talk | contribs)

Jump to: navigation, search

Contents

Download

Download the latest utility programs and modules from:

http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/

Example: btrfs-0.16.tar.bz2, btrfs-progs-0.16.tar.bz2

See also Btrfs source repositories for SCM access, and Hot Fixes for links to the latest updates.

Compiling the Kernel Module

Btrfs uses libcrc32c in the kernel for file and metadata checksums. You need to compile the kernel with: CONFIG_LIBCRC32C=m or CONFIG_LIBCRC32C=y

Once your kernel is setup, typing make in the btrfs module sources will build against the running kernel. When the build is complete:

modprobe libcrc32c ; insmod btrfs.ko

Compiling Btrfs Utilities

The Btrfs utility programs require libuuid to build. This can be found in the e2fsprogs sources, and is usually available as libuuid, uuid-dev or e2fsprogs-devel from various distros. Building the ext3 conversion tools requires libe2fs, which is usually available in e2fsprogs-devel as well.

Building the utilities is just make. If you would also like the ext3 conversion program, type make convert.

make install will copy the programs into /usr/local/bin

Basic Filesystem Commands

  • mkfs.btrfs: create a filesystem
  • btrfsctl: control program to create snapshots and subvolumes and scan devices
    • Scan all devices looking for btrfs filesystems, or scan just one partition
      • btrfsctl -a
      • btrfsctl -A /dev/sda2
  • Snapshots and subvolumes
    • mount -t btrfs -o subvol=. /dev/sda2 /mnt
    • btrfsctl -s new_subvol_name /mnt
    • btrfsctl -s snapshot_of_default /mnt/default
    • btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name
    • btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol
      • ls /mnt
        • default snapshot_of_a_snapshot snapshot_of_new_subvol
        • new_subvol_name snapshot_of_default
  • btrfsck: do a limited check of the FS extent trees.
  • debug-tree: print all of the FS metadata in text form
    • debug-tree /dev/sda2 >& big_output_file

More Informations on the commands.

Personal tools