> Why is it bad to perform fsck on a file system that is mounted?
Because fsck can modify data on the disk and the filesystem code in the
kernel doesn't know about the modifications.
> The
> reason that I'm asking is because, today in the office (without my
> knowledge) some people moved a desk and workstation. They
> inadvertantly, disconnected my power supply cord. My OpenBSD box lost
> power. I'm a little bit upset, but there's not much I can do about it.
> I know that they didn't do it deliberately.
>
> However, I want to ensure that the filesystems are ok. I know at boot
> time, fsck runs, and probably corrected things. However, I just want to
> be sure.
It's more probable that you will shoot yourself in the foot than correct any
errors.
/etc/rc would stop if there were any uncorrectable errors in your filesystems
and even if that failed the kernel refuses to mount dirty filesystems
read/write.
//art
Andy,
As posted, fsck will "fix" a file system which has updates buffered. Bad.
Other options:
A) Just reboot and let the powerup fsck do its job, as others have posted.
2) Boot to single user mode. This will only mount / so you may safely fsck
the other partitions again.
III) # kill all processes which might use the disk.
# sync; sync (The second sync guarentees that at leaste the first one
finished before you get a prompt.)
# fsck (but DON'T let it actually fix anything! Hint, that kill command
probably isn't possible...)
Good luck. We really do appreciate the level of paranoia and distrust
which you display ;-). People who just trust the system don't frequent
this site. :-)
Bob W.
Andrew Falanga <afal...@syracusenetworks.com>@openbsd.org on 02/25/2000
01:37:28 PM
Why is it bad to perform fsck on a file system that is mounted? The
reason that I'm asking is because, today in the office (without my
knowledge) some people moved a desk and workstation. They
inadvertantly, disconnected my power supply cord. My OpenBSD box lost
power. I'm a little bit upset, but there's not much I can do about it.
I know that they didn't do it deliberately.
However, I want to ensure that the filesystems are ok. I know at boot
time, fsck runs, and probably corrected things. However, I just want to
be sure.
Andy
> Why is it bad to perform fsck on a file system that is mounted? The
> reason that I'm asking is because, today in the office (without my
> knowledge) some people moved a desk and workstation. They
> inadvertantly, disconnected my power supply cord. My OpenBSD box lost
> power. I'm a little bit upset, but there's not much I can do about it.
> I know that they didn't do it deliberately.
You can do an 'fsck -n' (no-write mode) safely, but changing a live
filesystem will result in corruption. Basically, you would be
changing the filesystem behind the kernel's back, which is a problem
since due to caching, the on-disk state of the filesystem != actual
state of the filesystem.
If the machine rebooted into multi-user after the power outage, the
filesystem shoudld be fine. When there are non-trivial filesystem
problems, fsck will punt and you'll have to run an fsck manually
(interactively). If this didn't happen, you're fine...
- todd