Getting started

From btrfs Wiki
Revision as of 19:28, 30 April 2009 by Nightrow (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

If you are running the latest Btrfs code from the unstable repository, you'll need to also configure zlib compression into your kernel:

CONFIG_ZLIB_INFLATE and CONFIG_ZLIB_DEFLATE for btrfs newer than v0.16

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 ; modprobe zlib_inflate zlib_deflate ; 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. You also need the zlib development headers, usually available in a package called zlib-devel or zlib1g-dev.

Building the ext3 conversion tools requires libe2fs (usually available in e2fsprogs-devel or e2fslibs-dev) and libacl (may be available in libacl1-dev).

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 /dev/sda2 /mnt/btrfs
    • btrfsctl -S new_subvol_name /mnt/btrfs
    • btrfsctl -s snapshot_of_root /mnt/btrfs
      • mount -t btrfs -o subvol=new_subvol /mnt/new_subvol
      • mount -t btrfs -o subvol=snapshot_of_root /mnt/snap
  • btrfsck: do a limited check of the FS extent trees.
  • btrfs-debug-tree: print all of the FS metadata in text form
    • debug-tree /dev/sda2 >& big_output_file
  • If a problem occures you can create an image of the fs with btrfs-image and send it to the devs. (All data will be zeroed, but metadata and the like is preserved.)
    • btrfs-image -c 9 /dev/sda2 /tmp/btrfs_dump.z


More Informations on the commands.

Personal tools