You are not logged in.

#1 2012-05-13 22:23:50

vinicius
Member
Registered: 2009-02-07
Posts: 37

[SOLVED] Accidentally delete boot partition

Hi

A while ago, I installed Arch and left a partition empty for a future windows installation. The partition table was:
sda1: Empty
sda2: boot
sda3: Arch
sda4: swap

Arch was 100% during this period, until today, when I tried to install windows. sad
For lack of attention, I've accidentally deleted the boot partition during windows installation. I didn't realize that until trying restore Grub and noticing I couldn't find stage1 anymore.

I was trying to install Grub in sda3 with a live CD, but I couldn't get that right. Now, fsdik gives me:
sda1: NTFS (I think it is the windows bootloader)
sda2: NTFS (windows)
sda3: Linux
sda4: Linux/swap

I know that my files and the both system are ok, although I cannot boot none of them now.

What could I do to install Grub in sda3?
(I've tried to follow https://wiki.archlinux.org/index.php/GR … _GRUB_libs but it didn't work)

Thanks in advance

Last edited by vinicius (2012-05-14 00:27:02)

Offline

#2 2012-05-13 22:55:38

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: [SOLVED] Accidentally delete boot partition

How about removing any /boot related entries in your fstab, booting the arch USB, mounting sda3 as /chroot or something, mount proc, sys, chroot in, do grub-install? (or grub-setup)

Offline

#3 2012-05-13 23:21:59

vinicius
Member
Registered: 2009-02-07
Posts: 37

Re: [SOLVED] Accidentally delete boot partition

Hello, Fackmato

I tried that, there were no errors but the result was the same: when I trying to boot, grub console shows up.
I think that somehow I should put back in (sda3)/boot the content of old (sda2)/boot. I mean kernel image, menulist, etc. The problem is that usually this is done automatically during the installation, so I don't know how to generate these files.

Offline

#4 2012-05-13 23:42:44

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: [SOLVED] Accidentally delete boot partition

vinicius wrote:

Hello, Fackmato

I tried that, there were no errors but the result was the same: when I trying to boot, grub console shows up.
I think that somehow I should put back in (sda3)/boot the content of old (sda2)/boot. I mean kernel image, menulist, etc. The problem is that usually this is done automatically during the installation, so I don't know how to generate these files.

Reinstall GRUB. (pacman -S grub should suffice I think, but be sure to double check).

Then you can reinstall the kernel (pacman -S linux), it should regenerate the initrd for you as well. If it doesn't, you can do it with mkinitcpio -p linux.

Offline

#5 2012-05-14 00:26:37

vinicius
Member
Registered: 2009-02-07
Posts: 37

Re: [SOLVED] Accidentally delete boot partition

Fackamato wrote:

Then you can reinstall the kernel (pacman -S linux), it should regenerate the initrd for you as well. If it doesn't, you can do it with mkinitcpio -p linux.

All right. Before being able to read your reply, I could manage to find that out. But your hint is totally valid. Just for the record, what I've exactly done was:

1. Boot from Arch live CD;
2. Mount and chroot sda3;
3. Delete /boot line from /etc/fstab;
4. # cp -a /usr/lib/grub/i386-pc/* /boot/grub
5. Reinstall the kernel with pacman -S linux;
6. Manually create a menu.lst file;
7. Reboot.

That did the trick.
I had to write menu.lst because neither grub-install nor grub root setup procedure had generated the file.

Now, I'm going to include windows chainloader to menu.lst but I'm not expecting trouble with that.

Thank you very much, Fackmato! smile

-----
Edit: Including step 4.

Last edited by vinicius (2012-05-14 02:05:45)

Offline

#6 2012-05-14 02:00:41

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: [SOLVED] Accidentally delete boot partition

vinicius wrote:

Thank you very much, Fackmato! smile

No problem, glad you got it working!

Offline

Board footer

Powered by FluxBB