Oops /boot partition deleted
May 27, 2014 Leave a comment
I had an oops moment when I momentarily booted back into Windows to build a cygwin offline installer for work (for OpenSSH). For some reason I had chosen the D: drive to download the temp packages. The D: drive was also the drive letter than ExtFS associated with my linux /boot partition.
In a moment of brainlessness I deleted the files on the D:\ drive, not even realising what I was doing until I tried to boot back into my Ubuntu.
But as is the case with most things in linux, Google came to the rescue.
I hunted up my Ubuntu Gnome USB install key and booted into that. I then used fdisk to find the right /dev/Xda drive for my installation and then…
sudo mkdir /mnt/sysimage
sudo mount /dev/sda7 /mnt/sysimage
sudo mount /dev/sda5 /mnt/sysimage/boot
sudo chroot /mnt/sysimage/
sudo apt-get install linux-image-`uname -r` linux-image-extra-`uname -r`
And a reboot later and I am back in business.