Solved fsck in single mode VS fsck in multiuser mode

Hello,

I have a strange issue with my FreeBSD 8.1. From time to time it crashes when I build ports or I do incremental searches through the files of the some directories.

Running [cmd=]fsck -y[/cmd] in multiuser mode reveals some problems (see below), but running it in single user mode reveals no problem. I repeat the command in both scenarios and get the same results as described.

My PC has a P3 processor, 512 MB of RAM and it serves as a router and file server, so nothing too demanding. I thought it might be a disk problem, so I changed the disk with another one, with the same results. I thought I have made some mistakes when upgrading the system from FreeBSD 8.0 to 8.1, so I reinstalled the PC with version 8.1, with no use.
This PC served as a Debian router and file server for the past 4 years, until I decided it was time to discover new things. I had no crash issues before.

What I really don't get is why the output of the [cmd=]fsck -y[/cmd] differs in multi user mode versus the single user mode. Any explanation might be appreciated.

Below the output from multi user mode fsck:
Code:
* /dev/ad0s1a (NO WRITE)
** Last Mounted on /
** Root file system
** Phase 1 - Check Blocks and Sizes
INCORRECT BLOCK COUNT I=1017117 (4 should be 0)
CORRECT? no

** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=871489  OWNER=root MODE=140666
SIZE=0 MTIME=Oct 10 19:59 2010 
CLEAR? no

** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? no

SUMMARY INFORMATION BAD
SALVAGE? no

BLK(S) MISSING IN BIT MAPS
SALVAGE? no

213291 files, 760683 used, 3300379 free (13355 frags, 410878 blocks, 0.3% fragmentation)

Thanks,
mdaocus
 
You may or may not wish/be able to try the following:

Add-in a pci slot cooler (fan) card; ... Underclock the CPU for port builds (20 percent?);... Check if the PSU is upto capacity.

Sorry cannot comment on the multi-user fsck. Is not EACH fsck unique and solved by either multi-user OR single-user? So I am at a loss as to how to compare. (Each fsck operating on different files/inodes, and once fixed, the next fsck is totally different AFAIK.)
 
When a filesystem is mounted fsck cannot fix certain errors. That's the biggest difference.

The answer can be found in the fsck(8) man pages.
 
You shouldn't run fsck on an active (mounted) filesystem. The results are invalid, and fsck will refuse to 'fix' any errors.
 
Did you test your RAM with memtest86? What you say sounds like instability. And as said, you need to unmount a filesystem before you can repair it; UFS only has offline filesystem check. Have a look at ZFS filesystem if you want damage to be fixed automatically, without ever needing to offline your filesystem.
 
It should be worth mentioning background mode of fsck(8) (-B). It's enabled by default and if you're using softupdates background checks occur automatically during startup...
 
Thanks for the replies!

I suspect hardware issues beside the disks, because I tested the same disks on another PCs, with FreeBSD, and I had no issues there during compilations etc. I did not run memtest (yet).

The only think that I couldn't understand is why the fsck reported different things in different modes (single versus multi user). I understand the fact that in cannot correct mounted files systems, but I would expect the fsck reports to be consistent in all modes. Maybe it's the implementation of fsck ...

Coming back to practical stuff: what Live CD do you recommend to boot with, in order to fsck the hard disks in unmounted state? I tried with the installer CD but I cant see any way to do it. I need something like the SystemRescueCd of Linux which runs from CDROM (not DVDROM).

For somebody technically inclined and knowledgeable with Linux and Windows, starting up with *BSD is kind of a challenge. You quickly fall in love with the ports system, with PF, with how easy it is to setup a wireless Access Point in FreeBSD, but from time to time you'll get some "Ha?" moments. This is way this forum and your support is much appreciated.

Thanks again,
mdaocus
 
mdaocus said:
Coming back to practical stuff: what Live CD do you recommend to boot with, in order to fsck the hard disks in unmounted state? I tried with the installer CD but I cant see any way to do it. I need something like the SystemRescueCd of Linux which runs from CDROM (not DVDROM).
Every filesystem except the root filesystem (/) can be checked if you boot to single user mode. In that mode only the kernel is started and the root filesystem (/) is mounted read-only. All other filesystems are not mounted.

The only reason you would need a boot CD is when this filesystem is corrupt (unlikely) or the whole system refuses to boot. The install CD has a "Fixit" shell option. You can use that. For most this should do. The only thing to watch out for is when you are using ZFS. The installed version of ZFS (from -STABLE i.e.) might be slightly newer then the one on the RELEASE CDs.

For somebody technically inclined and knowledgeable with Linux and Windows, starting up with *BSD is kind of a challenge. You quickly fall in love with the ports system, with PF, with how easy it is to setup a wireless Access Point in FreeBSD, but from time to time you'll get some "Ha?" moments.
The thing to watch out for is linuxisms. The fanboys will probably kill me for it but Linux[*] borrows a lot from Windows. This is to make it easier and more understandable for people switching over. People who are used to Windows (and never knew anything else) expect certain actions or naming conventions to be the same. The BSDs are more traditional UNIX.

[*] I meant that in a general sense. I know some Linux distributions are more like BSD or even System V :P
 
mdaocus said:
The only think that I couldn't understand is why the fsck reported different things in different modes (single versus multi user). I understand the fact that in cannot correct mounted files systems, but I would expect the fsck reports to be consistent in all modes. Maybe it's the implementation of fsck ...
There's nothing wrong with fsck(1). The thing is that filesystem operations aren't written synchronously to disk. For any practical purpose, an active filesystem is always inconsistent on disk (except for brief moments when data/metadata is flushed). As a mounted filesystem is inherently inconsistent (as it's represented on disk), the errors reported by fsck(1) are bogus and totally useless.
 
Last edited by a moderator:
Exactly, fsck(1) will report errors on / when mounted read/write on pretty much any Unix/Linux system. It's totally normal, that is the difference between single-user and multi-user with respect to fsck(1).
 
Last edited by a moderator:
Hm, what jalla says makes sense. Even if I didn't encounter this in other OSes... OK, I guess we can close this thread.
 
Back
Top