[NTLUG:Discuss] Grub assistance

David Stanaway david at stanaway.net
Wed Jan 23 19:49:53 CST 2008


David Simmons wrote:

> currently don't have?).   Forget about the rest of the
> article...maybe a google search on 'fdisk /mbr' will convince you more?

That works on the windows/dos version of fdisk

Consulting my man page for disk show no reference at all to mbr.

SYNOPSIS
        fdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device

        fdisk -l [-u] [device ...]

        fdisk -s partition ...

        fdisk -v


$ sudo fdisk /mbr /dev/hda

Usage: fdisk [-b SSZ] [-u] DISK     Change partition table
        fdisk -l [-b SSZ] [-u] DISK  List partition table(s)
        fdisk -s PARTITION           Give partition size(s) in blocks
        fdisk -v                     Give fdisk version
Here DISK is something like /dev/hdb or /dev/sda
and PARTITION is something like /dev/hda7
-u: give Start and End in sector (instead of cylinder) units
-b 2048: (for certain MO disks) use 2048-byte sectors


I don't mean to bug you on this, but if you are going to give advice on 
something that pertains to the boot ability of a system and the 
partition table - PLEASE - be sure you understand and know it works 
before you wget -O - 'http://google.com/search?btnI=1&q=linux+mbr+fdisk' 
| mail discuss at ntlug.org



My advice for the problem is to
1) grub-install /dev/sdb
2) Look at the content of the grub config - you will probably not want 
to edit this until you have verified that you are able to boot from the 
other disk.
3) Boot in and edit the default grub entry. You will want to set:
  root            (hd0,0)
and add: single to the end of the kernel line.

EG: My Debian system has:
title           Debian GNU/Linux, kernel 2.6.22-3-686
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.22-3-686 root=/dev/hda1 ro
initrd          /boot/initrd.img-2.6.22-3-686

CHECKPOINT:

If you didn't get a grub menu when you turned the computer on after 
pulling the first disk, then you didn't successfully install grub. Put 
your drive back and there should be no damage done.

If you did successfully boot in single user mode,
you can
mount -o rw,remount /
vi /boot/grub/menu.lst and make your change to the root permanent.
vi /etc/fstab and make your references to /dev/sdb into references to 
/dev/sda
mount -o ro,remount /
sync
shutdown -r now

Should be OK.

Before I did this on a system, I would be sure I had a live cd that 
works or a rescue cd/floppy that works so that you can repair boot.lst, 
fstab and grub install if you didn't get it right.









More information about the Discuss mailing list