openSUSE 11.4, I have boot partition on pendrive.

The problem is when I boot computer, grub immediately shows error "file not found" (I have no clue which file) and switches to "rescue mode".

I can boot computer from another pendrive, but I would like to use the original one (the one mentioned above). I tried to refresh grub using Yast, or manually by executing

grub --batch < /etc/grub.conf

or by copying all the files from working pendrive to the non-working (editing device.map after that), still no success, "rescue mode" is all I see.

I know one way to rebuild the content of the pendrive (it contains only boot partition) by reinstalling entire system again, and this will force building boot partition again correctly, but I am looking for something more clever.

So, how to rebuild entire boot partition+grub, not just polish 2 or 3 files within it.

  • Ok, so first - how did you create the boot partition on the pendrive in the first place? Second - would it satisfy you to just make the original pendrive work exactly as the second one does? – rozcietrzewiacz Aug 7 '11 at 13:47
  • @rozcietrzewiacz, The original pendrive was creating during installation process (second too, that's why I know for sure it is valid and working way to create boot partition+grub). Yes, it would be completely OK with me to make the first pendrive as the second one (please note, those pendrives differs in capacity and partition sizes). – greenoldman Aug 7 '11 at 14:20

Ok, so if it satisfies you to have the old pendrive work as the second one, here's how you can do it:

  1. Back-up the contents of the old pendrive.
  2. Once you have both pendrives attached and your system running, re-partition the old pendrive in similar manner to how the second one is partition - that is to say, make the /boot partition on the old one have the same number and type as on the new one (refer to the outputs of fdisk -l). Don't forget to make it bootable.
  3. Clear (keeping a backup somewhere) the contents of /boot/ on the old pendrv and copy all the files from the new one.
  4. Unmount both pendrives, remembering which is which (i mean /dev/sd[ab] etc.)
  5. Overwrite the bootsector of your old pendrive with the one from your new:

    Here, I'm assuming /dev/sdb is your OLD pendrive and /dev/sdc is the NEW one - make sure to replace those with appropriate device names, otherwise you can even mess up your entire system!

    dd if=/dev/sdc bs=512 count=1 of=/dev/sdb

Once again, the if= parameter must point to the new one - the one that works fine now and the of= parameter must point to the OLD pendrive (the one to be fixed).

That should be it. The old pendrive should work just as the new one now.

  • You are my hero! I didn't run all steps, after reading your solution I copied both boot sectors to files and compared them. They differed! Then I copied one MBR to another as you wrote in step (5). And after that I finally get my system exactly as before. How can I add 1 million points to your account? ;-) But seriously, I guess the solution to my other problem unix.stackexchange.com/questions/18195/… which you already know is to create MBR having only install CD. Could you tell how to do it in the OTHER post? This would be solution. – greenoldman Aug 7 '11 at 15:04
  • :) Great. I'm happy with your happiness :) – rozcietrzewiacz Aug 7 '11 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.