In the last few days, my FreeBSD box drove me crazy with the kernel panic. The error message is shown below:
dev = ad14s1f, block = 1, fs = /usr panic: ffs_blkfree: freeing free block cpuid = 4 KDB: stack backtrace: ...
I am not sure what caused this kernel panic, but it happened few times a day for a week. Every time it happened, I had to reboot my machine manually. After some investigations, I found the following solution:
1. Boot into the single user mode.
2. Run the following command to force (-f) the system to check the system. It is likely that you will get a lot of error, so adding a -y option (which assume yes to all the questions) will make your life easier:
fsck -f -y
After the check is done, reboot the system to normal mode:
The reason why my system had this kind of issue was due to the filesystem inconsistency. Even the fsck was trigger after each system was crashed, it could not detect or repair the problem (fsck will not fix any problem on a mounted partition on a running system.). That’s why we need to do it in the single user mode.