Friday, December 30, 2011

Compiling btrfs-progs on Ubuntu

I needed to compile the newest version of btrfs-progs to fix a broken btrfs filesystem.

First a little background information. I'm running Ubuntu 11.10 on an older i386. I noticed one day that I couldn't ssh into my system so I went to check on it. The caps-lock and scroll-lock keyboard lights were flashing so no Alt-SysRq-REISUB. I was forced to push the reset button.
Mount failed after the reboot with lots of parent transid verify failed messages. Lucky for me (or not) it was my home partition so I could still get some system access.

First I installed the latest mainline Ubuntu kernel available here:
To actually get btrfs-tools to compile this is what was required.

If you don't already have git installed:
apt-get install git-core

make a directory for the source and cd into it:
mkdir ~/src
cd ~/src

get the source:
git clone git://

install some compile dependencies (You may need more. Watch for errors during make.):
apt-get install zlib1g-dev libattr1-dev uuid-dev

maybe run this:
apt-get build-dep btrfs-tools

cd into the btrfs-progs source:
cd btrfs-progs

compile with make:
make && make btrs-select-super && make btrfs-zero-log

sources (sorry if I missed some):

No comments: