Author Topic: lost /boot partition --- how to recover it?  (Read 2814 times)

tomfromdare

  • Zen Apprentice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
lost /boot partition --- how to recover it?
« on: September 01, 2011, 04:49:14 pm »
Problem:  drive with boot partition failed completely

I set up mirrored drives for the main installation, but created a /boot partition at the beginning of drive sda, and a swap partition at the beginning of sdb, installing Zentyal 2.0.13, kernel 2.6.32-24-generic x86_64

/dev/sda1   /boot  (1 GB)
/dev/sdb1   swap (1 GB)
/dev/md0   (sda5 & sdb5) /

Since drive sda has become totally unreadable, I avoided rebooting while adding an external USB drive, partitioned exactly as the others, failed sda5 and added sdc5 to software RAID (it synced in 4 hours), and mounted sdc1 and installed grub there.

HOWEVER I know the rest of /boot is missing, confirmed by the smaller used space there.

I've booted from usb Zentyal, and can't find a tool to reinstall /boot.

I've got another box built with the same hardware running Zentyal 2.0.22, kernel 2.6.32-26-generic x86_64.  WOULD IT BE OK to make a backup of that partition, and copy it into the new /boot partition?  Then, I suppose, update grub?

Better idea?  I've got to solve this before an extended power outage!

Thanks, 
Tom
« Last Edit: September 01, 2011, 04:50:49 pm by tomfromdare »

tomfromdare

  • Zen Apprentice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: lost /boot partition --- how to recover it?
« Reply #1 on: September 11, 2011, 04:59:05 pm »
Wow -- lots of views but no reply.

Well, on Friday (after consulting with a Linux guru associate) I repaired the installation!

Here's what it took:
At working machine, identical to ailing machine execpt for kernel version: sudo cp -a /boot/* /media/flash/BootPartBack
At ailing machine: sudo cp -a /media/flash/BootPartBack/* /boot
sudo apt-get install (same kernel version as working machine), as it was one version behind, which updated grub successfully
sudo tune2fs -l /dev/sdc1 (to get UUID of new boot partition)
sudo vi /etc/fstab  (to replace previous UUID with current UUID)
physically replace the failed drive with the new drive (which had been in external USB adapter)
REBOOT, and see the partition was automatically checked for errors, then boot proceeded!

Subsequently, I've copied the contents of /boot to a new folder on the mirrored drives, so it can be restored from there, should the first drive die again.  I'll have to remember to refresh that backup after each kernel upgrade.  Better techniques are welcomed...

Hope this helps anyone, like me, learning their way around software RAID.