Using The BTRFS Filesystem On Debian Lenny

Want to support HowtoForge? Become a subscriber!
 
Submitted by filipn (Contact Author) (Forums) on Mon, 2009-03-30 18:59. :: Debian

Using The BTRFS Filesystem On Debian Lenny

This tutorial shows how you can build the kernel and tools to use the new BTRFS filesystem on Debian Lenny.  Btrfs is a new copy on write filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration.

 

Obtaining And Compiling A 2.6.29 Kernel

First, we must download the kernel source, unpack it and copy the actual kernel configuration to the source directory. This reduces the required changes to the kernel configuration to a minimum. Of course, we can change more in the configuration if we want. We also have to install some packages which are required to succesfully compile the kernel.

apt-get install bzip2 libncurses5-dev kernel-package zlib1g-dev

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.tar.bz2
tar -xvjf linux-2.6.29.tar.bz2
cp /boot/config-`uname -r` /usr/src/linux-2.6.29/.config

Then we must configure the new kernel:

cd linux-2.6.29
make menuconfig

We should change at least two parameters in the kernel config. One is required, the second one is recommended.

File systems -> Btrfs filesystem (EXPERIMENTAL) Unstable disk format

Processor type and features -> Processor Family -> "our processor"

In both cases we have to type space when we highlight the right option. When we choose the processor we are back one level down and we can see our choosen processor next to "Processor family". When we choose Btrfs filesystem we can see an asterisk <*> right before "Btrfs filesystem".

Then we must tap ESC key two or more times and answer yes to the question of saving file changes. Now we can start to compile the kernel which takes some time.

make-kpkg linux-image linux-headers --initrd

Now we can install our brand new kernel:

cd ..
dpkg -i linux-image-2.6.29_2.6.29-10.00.Custom_i386.deb
dpkg -i linux-headers-2.6.29_2.6.29-10.00.Custom_i386.deb

After that we should reboot the computer and run it with the new kernel.

 

Compiling BTRFS Tools

cd /home/filip

Of course we use here our home directory.

apt-get install uuid-dev e2fslibs-dev libacl1-dev

wget http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/btrfs-progs-0.18.tar.gz
tar -xvzf btrfs-progs-0.18.tar.gz
cd btrfs-progs-0.18
make
make convert
make install

Now we have all and we can start using disks in btrfs format.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Sun, 2009-10-18 01:52.
where is the "Using"? just see the "Installing"...
Submitted by PENIX (not registered) on Tue, 2009-07-14 23:13.
I have conclusively proven that btrfs is actually a blatant repackaging of reiser4 in a cover up to avoid the political disaster of supporting the code of a convicted murderer. btrfs is 81.56% similar to reiser4. Here are the steps to reproduce. Please spread the word. http://pastebin.com/ff42272d http://pastebin.com/f27912488
Submitted by Anonymous (not registered) on Tue, 2009-09-22 19:29.

Please do not use the comment function to ask for help!"

Except this guy....

Please.... feel free to use any means necessary to ask for help, PENIX.  No, really.

Submitted by Russ Weeks (not registered) on Thu, 2009-04-02 01:37.

I suggest adding zlib1g-dev to your apt-get line, otherwise you may encounter these errors:

btrfs-image.c:29:18: warning: zlib.h: No such file or directory
btrfs-image.c: In function ‘dump_worker’:
btrfs-image.c:216: warning: implicit declaration of function ‘compressBound’
btrfs-image.c:219: warning: implicit declaration of function ‘compress2’
btrfs-image.c:222: error: ‘Z_OK’ undeclared (first use in this function)
btrfs-image.c:222: error: (Each undeclared identifier is reported only once
btrfs-image.c:222: error: for each function it appears in.)
btrfs-image.c: In function ‘restore_worker’:
btrfs-image.c:599: warning: implicit declaration of function ‘uncompress’
btrfs-image.c:601: error: ‘Z_OK’ undeclared (first use in this function)

Otherwise, very useful article.  Thanks!

Submitted by Anonymous (not registered) on Sun, 2009-11-01 00:41.

don't work for me when i try to mount a btrfs device :

ie : mount /dev/sdb /mnt 

i  have this

 [  904.015684] device fsid 6048d69d15d2adcf-9b3fbdc59c57f490 devid 1 transid 7 /dev/sdb
[  904.017784] BTRFS: couldn't mount because of unsupported optional features (1).

 any suggestions ?

Submitted by gonX (not registered) on Fri, 2010-03-19 20:57.
While you shouldn't be asking for help through the comments, you're probably using a kernel that's too old with userspace tools that are too recent. Upgrade to .30 or later.