Fix Your Catastrophic Screw-ups with Knoppix
What is Knoppix?
A complete Linux distribution that runs directly from a bootable CD-ROM, Knoppix has many uses:
- Demonstrate Linux to newcomers
- Make Linux easier to install
- Rescue disc (for Linux and Windows)
- Many other uses
When Do You Use a Rescue CD?
- When your system doesn't boot
- Corrupted/missing kernel
- Corrupted/misconfigured/missing boot loader
- Migrate the system
- Full imaging (dd, etc.)
- Upgrade to a larger drive (cp, find|cpio, etc.)
- Forensics, rootkit/virus scanning, etc.
Knoppix the Rescue Disk
- Excellent hardware detection
- Safe for the underlying system (mounts read-only by default)
- Comes with many useful rescue tools including lilo, grub, dd, gpart, dpkg, rpm, etc.
- Full Internet access for troubleshooting
root@ttyp0[/]# rm -rf .
C:\ fdisk /mbr (or installing Windows)
root@ttyp0[/]# dd if=/lib/grub/i386-pc/stage1 of=/dev/hda bs=512 count=1
Death-(well MBR-)defying Live Demo!
Delete the complete Master Boot Record and restore it and grub using Knoppix
I Like My Laptop
- Fujitsu P2110 (867Mhz Crusoe, portable, 10.6¿ 16:9 display, excellent battery life)
- Dual-boots Debian (95%) and Windows 2000 (5%)
- New 5400RPM 16MB cache hard drive
- Lots of custom scripts and tweaks (http://greenfly.org/fujitsu)
How to Erase Your MBR
root@ttyp0[/]# dd if=/dev/zero of=/dev/hda bs=512 count=1
Use console mode (boot with
Not necessary, but saves time since all the recovery tools are command line based
gpart (short for "Guess Partition") scans a drive for anything that looks like the beginning and end of a partition, then creates a MBR based on it
- works best with primary partitions
- not perfect (double check results)
- First run gpart without the -W option to test
root@ttyp0[/]# gpart /dev/hda
- Then use -W to actually write the changes
root@ttyp0[/]# gpart -W /dev/hda /mnt/hda
Tweak the Results
gpart might not correctly find the end of all of your partitions. Use a tool like fdisk or cfdisk to recreate the partition to fill up its space in this case.
- Mount the Linux partition that contains your /boot directory read-write
root@ttyp0[/]# mount -o rw /dev/hda3 /mnt/hda3
- Run grub-install to restore grub to the boot sector
root@ttyp0[/]# grub-install --root-directory=/mnt/hda3 /dev/hda