BTRFS and Ubuntu Lucid 10.04

Although Ubuntu Lucid 10.04 has native support for BTRFS, it does not like very much auto-mounting a BTRFS volume during start up. The problem seems to be that btrfsctl -a is not invoked during the boot process.

It takes some hacks to udev and initramfs to get this working. I found the solution in HowTO: Btrfs Root Installation:

This initramfs script will make sure the btrfsctl binary gets copied to the RAM disk:

$ cat /usr/share/initramfs-tools/hooks/btrfs
#!/bin/sh -e
# initramfs hook for btrfs

if [ "$1" = "prereqs" ]; then
    exit 0
fi

. /usr/share/initramfs-tools/hook-functions

if [ -x "`which btrfsctl`" ]; then
    copy_exec "`which btrfsctl`" /sbin
fi

I believe the following is not strictly necessary unless you plan on having a BTRFS-based root filesystem:

$ cat /usr/share/initramfs-tools/modules.d/btrfs
# initramfs modules for btrfs
libcrc32c
crc32c
zlib_deflate
btrfs

This will load the BTRFS module while the system boots up, and calls btrfsctl -a to prepare the BTRFS volumes:

$ cat /usr/share/initramfs-tools/scripts/local-premount/btrfs
#!/bin/sh -e
# initramfs script for btrfs

if [ "$1" = "prereqs" ]; then
    exit 0
fi

modprobe btrfs

if [ -x /sbin/btrfsctl ]; then
    /sbin/btrfsctl -a 2>/dev/null
fi

Mark the scripts executable:

chmod +x /usr/share/initramfs-tools/scripts/local-premount/btrfs
chmod +x /usr/share/initramfs-tools/hooks/btrfs

Rebuild the initial RAM disks and GRUB environment:

update-initramfs -u -k all
update-grub

That should do it.

Advertisements

3 thoughts on “BTRFS and Ubuntu Lucid 10.04

  1. I was very happy to find this internet-site.I wanted to thanks to your time for this wonderful learn!! I definitely enjoying each little bit of it and I’ve you bookmarked to check out new stuff you weblog post.

  2. Mike,
    The last few years have been a rollercoaster, and the turnover has been high, even for urban school standards. I think part of the reason is the previous principal had been there 30 years and when he left they have had a hard time finding a right fit. I don’t know what the answer is to the AP situation. It seems to be a stepping stone for most people who want to be principals, and the nature of it seems transitionary at best.
    I agree that struggling schools probably all struggle to retain administrators. Also, I’ve been saying for awhile now on my blog, we need twice as many administrators as we have. We have a principal and two APs, which is the same as when the school had 800 kids thirty years ago. We now have 2,000. Why oh why do we still have the same number of administrators? We need 2 principals and 8 Aps in my opinion, and the one in charge of discipline needs to be former military.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s