August 21, 2014
 
 
RSSRSS feed

Become A System Rescue Guru With Linux, Part 2 - page 3

Network Rescue

  • May 22, 2008
  • By Carla Schroder
When you run a multiboot system, sooner or later you're going to hork the MBR (master boot record). Windows lusers reformat and reinstall; ace Linux gurus perform skilled micro-surgery. If Windows takes over the MBR when you don't want it to, or a new Linux installations steals the MBR, boot SystemRescueCD and fix it this way:

First zero out the MBR, and preserve the partition table:

% dd if=/dev/zero of=/dev/hda bs=446 count=1
The MBR is 512 bytes, and the first 446 contain the boot records. The remaining 66 bytes contain your partition table, so you don't want to erase that. (If you're thinking wow, this seems rather quaint and archaic, you are correct. The x86 architecture still thinks it's running MS-DOS. And that is why modern operating systems contain so many kludges just to boot successfully.)

It's usually not necessary to do this when Linux controls the MBR, but it doesn't hurt anything and it's good to know how to do it. If you want Windows to control the MBR, then you do need to zero it out before installing Windows, or before running any Windows boot fixit tools.

OK then, enough of that dull Windows stuff. Let's get back to nice sane Linux and open the GRUB command console:

% grub
Probing devices to guess BIOS drives. This may take a long time.
 [snip boring stuff]
Now find GRUB's stage1 loader:
 grub> find /boot/grub/stage1
 (hd0,3)
If there is more than one, which there often is on a multiboot system, you need to know which one you want to use. (If you pick the wrong one, just boot SystemRescueCD and do it over.) Now enter the root partition:
 grub> root (hd0,3)
 Filesystem type is ext2fs, partition type 0x83
Then run GRUB's setup command:
 grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists...yes
 Checking if "/boot/grub/stage2" exists...yes
 Checking if "/boot/grub/e2fs_stage1_5" exists...yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
 succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,3)/boot/grub/stage2
 /boot/grub/menu.lst"...succeeded
 Done.
 grub> quit
When you reboot you'll be welcomed by your familiar GRUB menu.

In these two parts we've just scratched the surface of what you can do with SystemRescueCD. You can also rescue RAID and LVM volumes, do secure erasures, snarf up Windows passwords and edit the Registry, edit any Linux/Unix file, run benchmarks, burn in new systems, run virus scans, extract Windows CAB files, create and unpack compressed archives, and lots more. If you're not happy with the stock package selection, visit the Howto page to learn how to create your own customized rescue CD.

Resources

Carla Schroder is the author of the Linux Cookbook and the newly-released Linux Networking Cookbook, and is a regular contributor to LinuxPlanet.

Sitemap | Contact Us