Recovering lost /boot partition in Debian Jessie

Start situation: I have a 4 disk NAS sitting in my living room, which wakes up every day at 3am and collects backup data from all my remote servers. It consists of 4 big SATA drives, forming 2 RAID1 devices, which are both physical devices for one big LVM2 volume group.
The / partition for the Debian Jessie system resides on the LVM as a logical device, but for booting you need a special /boot partition NOT on the LVM. So I used a seperate USB stick for that, which stopped working a few days ago.
As I had no backup for this boot partition, I had to regenerate it. Here are the instructions for regenerating a lost /boot partition:

  • Download a matching installation CD for your system (in my case Debian Jessie i386)
  • Create a bootable device from it, instructions are in the Debian manual.
  • Boot from the new device, select Advanced -> Recovery mode at the boot prompt.
  • There will be some options where you can select a root device. In my case I had to assemble the RAID arrays first, then my LVM device appeared
  • Start a chroot in your old systems root device.
  • Attach the usb stick for the new /boot partition, partition it (1GB should suffice), create a new Ext3 filesystem and mount it under /boot
  • Execute grub-install --root-directory=/ /dev/sdX (where /dev/sdX is you new usb boot device). This should regenerate the /boot/grub directories and install the boot loader in the master boot record of the stick
  • Find out which kernel you were using before: dpkg -l | grep linux-image. In my case: linux-image-3.16.0-4-686-pae
  • Execute apt-get install --reinstall linux-image-3.16.0-4-686-pae
  • ..and after a update-grub, you should be ready to unmount your boot, exit the chroot and reboot your system.

Have fun!