initramfs for LVM
This is a simple initramfs for booting Linux from a root filesystem in an LVM volume. It is meant to be included in the kernel image.
Setup
- Download init and initramfs.list into the directory /usr/src/sys/initramfs.lvm
- Adjust your kernel source configuration under General setup select Initial RAM filesystem and RAM disk (initrams/initrd) support
- Enter /usr/src/sys/initramfs.lvm/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:
set timeout=5
set root=(lvm/vg00-lvroot)
insmod part_msdos
insmod part_gpt
insmod lvm
insmod linux
menuentry "Linux" {
linux /boot/vmlinuz root=/dev/mapper/vg00-lvroot
}
- You may add rootflags=... followed by comma-separated mount options for the root filesystem. Defaults to ro,noatime,nodiratime
- Likewise, rootfstype=... explicitly instructs the kernel that the root volume contains the given filesystem
- If you add dorescue to the kernel commandline, you will be dropped to a rescue shell inside the initramfs