Become A System Rescue Guru With Linux, Part 2 - page 3
Network RescueWhen 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=1The 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.)
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 0x83Then 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> quitWhen 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.
- DataRecovery; an excellent Ubuntu help page on using advanced tools to recover data from damaged files
- NTFS-3G Stable Read/Write Driver