Kernel Panics On *BSD's Due To Bad Storage Devices

[home]

The Problem

Whilst I was using a NetBSD system I was getting frequent kernel panics whilst copying over some files from FAT32 formatted drive and the same on an EXT2 formatted drive. The same problem also happened on an OpenBSD system.


The Solution

It took me a while before I had the light bulb moment that it was the drives that were the issue but simply the drives were "dirty" and needed to be cleaned. All we need to do is use the fsck utility to clean the drive.

First we must dertimine the file system type of the drive/partition that needs to be cleaned using the disklabel utility:

disklabel sd1

Change "sd1" with the appropriate drive, for FreeBSD the drive labels will look a bit different like ada0.

Now use fsck with the appropriate fs type as follows:

fsck_msdos /dev/sd1i

Of course, like before change "/dev/sd1i" with the drive and partition that you wish to clean. You will also want to change "fsck_msdos" with the fs type you need.

After all of this the drive should be clean and the kernel panics should stop