Skip to main content
pivica.me
Site about Drupal, Web Development, and other stuff...
  • Home
  • Blog
  • Projects
  • Drupal cheat sheets
  • About me
  • Contact
  1. Home
  2. Blog
  3. Reinstalling erased boot partition on linux

Reinstalling erased boot partition on linux

  • Log in to post comments

So I killed my boot partition including grub and all Linux kernel image files... Don't ask me how, I was doing some partition management quickly and bad thing happened ;)

Here are steps how to fully recover/reinstall your boot partition (my system is Kubuntu 11.10, and my boot partition was on /dev/sda3 - not on the same place where root partition is):

  1. boot with some live CD (preferably the same one like your distro is)
  2. Be sure to create boot partition again like ext4 (or what ever you very using before for file system for boot partition). For this live cd and some of graphical gui tools should be enough.
  3. Now lets install Linux images on your boot partition
    1. chrooting into your system $ sudo mount /dev/sdax /mnt/myroot (where sdax is your root partition) $ sudo mount /dev/sday /mnt/myroot/boot (we need to mount boot because it is on another partition /dev/sday) $ sudo mount ‐‐bind /dev /mnt/myroot/dev $ sudo mount ‐‐bind /proc /mnt/myroot/proc $ sudo mount ‐‐bind /sys /mnt/myroot/sys

      If you do not have network in your chroot then copy resolv.conf

      $cp -L /etc/resolve.conf /mnt/gentoo/etc/resolve.conf

      and finally do chroot

      $ sudo chroot /media/xx..xx

      now when you have chroot to your old system time is to reinstall missing kernel images

      1. first thing remove initrd.img symlink from your root because it can stop apt-get install command $ mv initrd.img initrd.img.OLD
      2. now install Linux image that you want $ apt-cache search 'linux-image' $ apt-get install linux-image-3.0.0-17-generic

        if you got error about missing memtest86+ do this then first

        $ sudo apt-get --reinstall install memtest86+
  4. finally lets restore grub $ sudo grub-install /dev/sda
Submitted on 02 April 2012

Tags

Linux

Related blogs

Remote FTP backups of your WHM/CPanel accounts

24 June 2012

Backup folders in Linux over rsync to Freenas disk

18 May 2012

© Copyright 2025 by Ivica

  • Instagram
  • Twitter
To top