initramfs for Btrfs
This is a simple initramfs for booting Linux from a root filesystem on a multi-device, i.e. mirrored Btrfs volume. It is meant to be included in the kernel image.
Setup
- Download init and initramfs.list into the directory /usr/src/sys/initramfs.btrfs
- Adjust your kernel source configuration under General setup select Initial RAM filesystem and RAM disk (initrams/initrd) support
- Enter /usr/src/sys/initramfs.btrfs/initramfs.list as Initramfs source file(s):

- Exit and save your kernel configuration
- (Re-)Build your kernel, e.g.:
$ make -j8 bzImage
$ make modules
- Install the kernel:
$ sudo cp arch/`uname -m`/boot/bzImage /boot/vmlinuz
$ sudo make modules_install
- Your /boot/grub/grub.cfg may be very simplistic, e.g. if the label of your Btrfs root volume is BUTTER (check the output of btrfs fi show):
set timeout=5
set root=(hd0,gpt1),(hd1,gpt1)
insmod part_gpt
insmod btrfs
insmod linux
menuentry "Linux" {
linux /boot/vmlinuz root=LABEL=BUTTER
}
- You may add rootflags=... followed by comma-separated mount options for the root filesystem. Defaults to ro,noatime,nodiratime
- If you add dorescue to the kernel commandline, you will be dropped to a rescue shell inside the initramfs