True Stories of Knoppix Rescues
by Kyle Rankin, author of Knoppix Hacks12/02/2004
As a sysadmin, I wear many hats. Some days I'm the janitor--I clean up discarded files on the file server and clear spam from the mail server. Other days I'm the maintenance man--I make sure all the servers are running smoothly and that any holes have been patched. Some days I'm the architect--I plan, organize, and design systems to suit our needs. Some of my favorite days, however, are the days I put on my rescue hat. When a machine is in trouble, the whistle sounds, I grab my rescue gear, and I run down the beach with my life preserver. OK, well, I made that last part up; I'm not David Hasselhoff and this isn't Baywatch, but when it comes to system recovery, I choose the other thing Germans love--Knoppix.
As a battle-hardened sysadmin, I've seen a lot of broken systems (some I broke, and some were broken for me). I've carried a number of rescue disks, including tomsrtbt and the LinuxCare Bootable Business Card, but over the past year or two, I've started to rely completely on Knoppix as an all-in-one rescue disk. Below are some real-life accounts of how I've saved some broken systems with just my Knoppix CD.
The first and only time I experimented with out-of-spec IDE cables was on my main workstation. The system was housed in a huge full-tower case with a motherboard that strategically placed the IDE connectors at the very bottom. The system had a lot of drives in it, and the only way I was able to connect the drives at the top of the case was to use IDE cables that were a few inches out of spec.
At first, everything seemed to work well; however, after some time and some heavy hard disk load, I noticed a few filesystem errors that culminated in not being able to mount the XFS root filesystem. Knoppix has had XFS support, including the complete set of XFS tools, for a long time, so I booted my Knoppix CD and was able to use its copy of xfs_repair to repair the damage with minimal data loss on the drive. I could then boot the system without having to reinstall (and subsequently replaced those IDE cables).
|
Related Reading
Knoppix Hacks |
One of my favorite stories of Knoppix recovery started when I was trying to reinstall grub on my laptop after moving around and resizing some partitions. The grub-install script didn't seem to work, so I went through the documentation to install grub to the MBR (Master Boot Record) using dd. What seemed like a good idea at the time was to follow grub's instructions for creating a boot floppy, only applying it to my hard drive with the command dd if=/usr/lib/grub/i386-pc/stage1 of=/dev/hda bs=512 count=1. In a way the command worked, in that it did copy grub to the boot code in my MBR (the first 446 bytes of /dev/hda), but it also copied over my partition table (the last 66 bytes of /dev/hda). The result was that grub started to load but was confused because it could find no partitions on the drive.
Before I gave up and reinstalled Linux over the top of my customized and fully configured install, I decided to research tools that might be able to find my partition. What I found was a great tool called gpart (short for guess partition). Gpart scans through a drive looking for partition signatures and pieces together a partition table based on what it finds. It just so happened that my Knoppix CD already had gpart installed, so I was ready to get to work.
Gpart works in a pretty straightforward way: you run gpart with a drive as an argument, and it will scan the drive and show you the partitions it finds. When you are ready to write the changes, you run gpart with the -W option, specifying which drive to write the partition table to. For my system, I ran gpart -W /dev/hda /dev/hda. From the output, it appeared that gpart was able to piece together my partition table for me. Once I wrote the changes, I rebooted back into the Knoppix CD, mounted my Linux filesystem, and saw that all of my files were still there!
All that was left was to do what I set out to do at the beginning--install grub. Since Knoppix included grub-install, I was able to install grub from within Knoppix by mounting my root directory read/write and running grub-install root-directory=/dev/hda3 /dev/hda. After another reboot, I was reunited with my grub boot menu and was able to boot back into my Linux system.
I suppose the moral of this story is to be careful when you play around with the dd command and your MBR, but the secondary moral is that if you aren't careful when you play around with the dd command and your MBR, Knoppix has the tools to help repair your damage. It has been a lifesaver for many of my Linux and Windows systems alike. The next time you have to put on your rescue hat, I recommend giving Knoppix a try.
Kyle Rankin is a system administrator who enjoys troubleshooting, problem solving, and system recovery. He is also the author of Knoppix Hacks, Knoppix Pocket Reference, Linux Multimedia Hacks, and Ubuntu Hacks for O'Reilly Media.
Return to the Linux DevCenter.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 11 of 11.
-
Partition recovery
2005-01-10 16:40:09 linuxrulz [Reply | View]
Well, I happened to have badluck too with partitions while using win98, some time ago.
I didn't used gpart but testdisk, which is multi-os. It saved me a lot too and it worked better than gpart I tried later.
-
Knoppix is handy for hardware swaps
2005-01-10 15:00:28 Hackrat [Reply | View]
I have a SCSI RAID system with a custom kernel and no initrd. I moved its disk into a system with a different SCSI chipset, and I did this before building a new custom kernel (because I knew Knoppix would help me make that work).
I booted the new system from a Knoppix CD, brought the RAID volumes (RAID5 for /, RAID1 for /boot) online with mdadm, fsck'd them (just because you're paranoid doesn't mean they aren't following you :-), mounted them, and chroot'd into the mount of my / partition.
Then I was able to build a new kernel (with the right SCSI driver) and install it where grub can find it. With Knoppix, chroot is handy for other things too, like upgrading or downgrading packages. A similar approach would work for making a new initrd, in a system which needs modules to mount the root partition, if hardware changes require a new initrd.
-
Knoppix has saved my @ss too many time to count...
2005-01-10 13:40:07 Dooglio [Reply | View]
Like the subject says. I've rescued systems so many times, Windows and Linux alike, I lost count! I've recovered data from my chiropractor's dead MS/DOS box. I used it to set up software raid on a root partition. I've used it to detect hardware. I've used it to demo linux to interested parties. In short, Knoppix is my friend.
I'm waiting for Knoppix for Mac. :-)
-
KNOPPIX SAVED MY LIFE
2005-01-10 12:16:32 |<|\||\|0P!X [Reply | View]
Recently, I had a heart attack while playing Doom 3 on my PC. Thinking fast, I booted into Knoppix and ran the 'fixheart' command and BAM! my heart started working again!
Another time when I was lonely, I ran the 'gimmegirlfriend' command and I instantly had a girlfriend!!! After some time I got bored with my new found girlfriend because she was taking away from the precious time with my computer and I ran the 'deletegirlfriend' command!
Knoppix is truely amazing... is there anything it can't do? I'm going to run the 'gimmecash' command next....
-
knoppix better than recovery console for windows 2000/xp
2005-01-10 11:37:56 faniggle [Reply | View]
i was running raid0 against 2 IDE disks when a bad stick of memory corrupted the ntfs partition on which all my data was housed. I could have lived without the data but it would have been nice to not rebuild from scratch. I swapped out the memory and attempted to boot from the w2k/wxp cds to perform a chkdsk /r. Turns out ntfs.sys crapped out when accessing the partition w/ a friendly bluescreen. I quickly withdrew my knoppix cd from its holster on my hip and was able to not only mount my raid volume but also recover with fixntfs and fully salvage all my data.
-
Knoppix + USB pen drive
2005-01-10 11:22:31 samgau [Reply | View]
Had a user bring in a laptop with a dying HD, winXP couldn't boot anymore and the user needed some important files. In comes knoppix and my trusted USB drive, booted the machine, found the files, thankfully the HD was not completely toast, plugged in the USB drive, knoppix had no troubles installing it, made it writable and copied the files over. Again, thanks knoppix... -
Knoppix + cd burner and/or usb drives
2005-01-10 20:26:18 madnashy [Reply | View]
I have my box set up with 2x ide removeable hard drives, a dvd rom, cd writer and net card. I have used knoppix as a disposable net surfing tool (no worries about spyware and viruses if I plan to visit dodgy sites), and for data backup (via usb drive and by cd-rom) I usually boot via my dvd drive so I can use the cd burner to backup all data. as an altenrative I sometimes use a blank HDD with fat32 as a backup if I'm retrieving data off a damaged windows install. so I have found knoppix useful for risky net surfing, data backup, media playing, file maintenance (deleting virus files, etc). soon I'll have a HDD with knoppix installed to make better use of other apps like Kmail with has some cool features I rarely see in other email apps.
[My Homepage]
-
Generic Laptop, XP recovery
2005-01-05 23:08:11 sootmann [Reply | View]
I had a white-box laptop with unknown components and a hosed Windows installation. I had to reinstall Windows and most things went fine but I had no idea what type of video card was in it. Windows will not automatically update the video driver if it already has a 'suitable' driver, in this case, generic VGA. I booted knoppix and issued 'lspci' which lists all the PCI (and related, i.e. AGP) devices. From this, I found it was a certain flavor of ATI card so I booted back into Windows, downloaded and installed the driver, and the laptop went from 640x480x16 colors to 1024x768x16.7Mcolors. I also used Knoppix and 'scp' to copy all the files from a spyware-infested WinXP box to a Mac OS X box. -
Generic Laptop, XP recovery
2005-01-10 12:41:39 buggerlugs [Reply | View]
Actually, there's a quick way to find out what video card is in your machine from the Windows command prompt.
First you need to get to a command prompt and run the 'debug' command. Now enter the following command at the '-' prompt (careful here!):
d C000:0010
Press <Enter>, and you should see the contents (in hex) of the start of your video BIOS. Press 'd' a few more times to get more information. For example, here's what I see on my Dell laptop:
-d C000:0010
C000:0010 44 45 4F 20 0D 00 00 00-F4 00 7B 13 00 00 49 42 DEO ......{...IB
C000:0020 4D 20 56 47 41 20 43 6F-6D 70 61 74 69 62 6C 65 M VGA Compatible
C000:0030 01 00 00 00 80 10 7B D9-30 37 2F 32 34 2F 30 32 ......{.07/24/02
C000:0040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
C000:0050 E9 DB 74 00 28 10 F4 00-E9 C4 12 E9 CB 12 50 4D ..t.(.........PM
C000:0060 49 44 58 00 5B 00 00 00-00 A0 00 B0 00 B8 00 C0 IDX.[...........
C000:0070 00 5B FF 7F 4E 56 00 05-14 C5 AA B0 52 01 11 03 .[..NV......R...
C000:0080 00 00 00 00 00 B7 94 B8-F8 01 00 00 00 00 00 00 ................
-d
C000:0090 0C 01 50 00 0C 78 71 28-D3 69 2D 6A BB 6E 70 6E ..P..xq(.i-j.npn
C000:00A0 84 6E 9D 01 C0 01 4F BE-00 01 01 00 3F 3E 37 36 .n....O.....?>76
C000:00B0 A8 3E 6A D0 6A 80 1A 06-00 40 0D 03 00 64 B6 B4 .>j.j....@...d..
C000:00C0 B6 BA B6 D2 B6 DE B6 DE-B6 B4 B6 16 C0 1C C0 00 ................
C000:00D0 00 00 00 22 C0 25 C0 00-00 00 00 7E 6B 4E 6B 04 ...".%.....~kNk.
C000:00E0 00 00 00 F4 D8 00 00 28-C0 6E 6B 5E 6B 00 00 00 .......(.nk^k...
C000:00F0 00 00 00 00 50 43 49 52-DE 10 12 01 00 00 18 00 ....PCIR........
C000:0100 00 00 00 03 70 00 01 00-00 80 00 00 4E 56 49 44 ....p.......NVID
-d
C000:0110 49 41 20 47 65 46 6F 72-63 65 32 20 47 4F 20 56 IA GeForce2 GO V
C000:0120 47 41 20 42 49 4F 53 0D-0A 00 00 00 00 00 00 00 GA BIOS.........
C000:0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
C000:0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
C000:0150 00 00 00 00 00 00 00 00-00 00 00 00 00 56 65 72 .............Ver
C000:0160 73 69 6F 6E 20 33 2E 31-31 2E 30 31 2E 35 32 2E sion 3.11.01.52.
C000:0170 41 38 20 0D 0A 00 43 6F-70 79 72 69 67 68 74 20 A8 ...Copyright
C000:0180 28 43 29 20 31 39 39 36-2D 32 30 30 31 20 4E 56 (C) 1996-2001 NV
-d
C000:0190 49 44 49 41 20 43 6F 72-70 2E 0D 0A 00 4E 56 31 IDIA Corp....NV1
C000:01A0 31 20 42 6F 61 72 64 00-00 00 00 00 00 00 00 00 1 Board.........
C000:01B0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
C000:01C0 43 68 69 70 20 52 65 76-20 42 32 00 00 00 00 00 Chip Rev B2.....
C000:01D0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 6E A3 ..............n.
C000:01E0 02 7A C3 02 79 D9 02 74-97 02 69 F3 02 61 08 03 .z..y..t..i..a..
C000:01F0 78 18 03 62 43 03 37 61-03 72 A9 03 67 25 06 66 x..bC.7a.r..g%.f
C000:0200 25 06 68 25 06 63 DA B4-65 AF 03 71 25 06 6C 25 %.h%.c..e..q%.l%






adn't rebooted my machine in who knows how long, for some reason or another I rebooted, only to discover my machine no longer booted and there was something seriously bork... spent until 11:50 trying to fix my machine until i remembered i had a knoppix cd lying around
booted up and did my taxes online...
so knoppix saved me from fate of willie nelson.