Ubuntu – How to stop hdd from causing a kernel panic and crashing

freezehard drivekernel

I accidentally booted into the Windows recovery partition which gave me an option to quit or continue to wipe the disk. I selected the option to quit but an onscreen message said initialising (which I thought was odd, since I expected it to just reboot when I selected quit). After a few minutes I cut the power to prevent it from overriding my hdd.

When I rebooted I got the grub rescue prompt but after using ls it turns out that every partition has msdos in the name, I..e hd0,msdos1. Then I tried my liveUSB but kept getting a kernel panic message saying out of memory (I have 2G of RAM so shouldn't be a problem). Finally I decided to remove the hdd. Now I can boot with my liveUSB but whenever I connect the hdd (using a SATA enclosure) it takes the entire OS down.

Any idea how I can inspect the hdd without it freezing the OS? I'm out of ideas!

  • With the hard drive removed and booting with a liveUSB from an SD card I can load ubuntu but as soon as I connect the hard drive (externally via USB using the enclosure) it causes ubuntu to crash. it also causes the same effect on another machine that's running fedora

  • The CPU and/memory usage sky-rockets until the pc OS becomes unresponsive (even when the drive is removed). The logs are a good idea, I didnt check because I'm using the liveUSB with no persistent storage (so the logs disappear when I hit the power button to reset the machine). However you gave me an idea and I've checked the messages log on the fedora machine. The last entry says "attached SCSI disk" which doesn't give much away but just before that it lists sdb1, sdb2 all the way through to sdb255… I've not seen that before.

  • So far its crashed both Linux computers that I've connected to. Windows does not cause a crash and detects that the drive is connected but fails to mount it. A pc repair shop will be too expensive. There must be a way to stop Linux from entering the continuous loop (which is what I assume is using all of the memory) when the hdd is plugged in?

Best Answer

Sorted! When the hard drive was connected to linux it would take down the system by causing a kernel panic. However it took a few seconds before the system stopped responding so I used a partitioning program on fedora to erase the mbr in those few seconds. Once the mbr was deleted I could connect it externally without it causing a system failure and then use other tool to recover data and reformat the hdd.

Related Question