"... they were afraid to run fsck for several months". That little sentence fragment was part of a support email I received this week. The email went on to say "After we ran it the system will no longer boot. (perhaps their fears were justified)."
I've heard similar things in the past. The fear is that fsck will "make things worse". The system is running now, it's working (or at least mostly working), so why tempt fate? The mental analogy here seems to be one of going in for surgery and dying from the anesthesia.
That's the wrong idea. Anything that fsck sees as needing fixing has the strong potential to make things worse, often much worse, if left unfixed. Yes, there may be unusual circumstances where I would want to not run fsck in order to examine or copy something before letting it do its repair. There might be times where I'd want to first run it with a "-n" (meaning report what needs fixing but do nothing). But in none of these cases would I then turn the system over to users.
There are things that fsck will fix that might be fine to leave untreated. For example, fsck looks for files that don't have an entry in any directory. It makes entries for those in the "lost+found" directory of the filesystem. If you have no need for those "lost" files, they really don't matter. They can sit out there in never-never land and never cause a problem. Fsck is not going to have any problem fixing these, either, so there's no reason not to let it do what it wants to do.
However, other filesystem screw-ups are more dangerous. If a disk block that belongs to one file also ends up among the blocks that are supposed to belong to another file, or is on the "free list" (meaning available for the next file that needs more blocks), that can really mess you up. That block will contain data from whichever file was last written to at whatever position the block lies. You have no way of knowing whether your application is writing accounts receivable data into the midst of your kernel or any other system file. File permissions don't matter; data will get written. You can lose application data or lose system files.
All fsck can do in that case is allocate a new block and copy whatever it has to there and then fix up the inode so there are no cross-linked blocks (dups). That doesn't really change anything - if you've already messed up important data, fsck won't make anything worse!
If the block is on the free list and you never need any more space or never need enough to get to where that block is allocated, sure, no problem. Again, it could sit on the free list forever and never cause a problem, but the moment it is allocated, the original file is at risk.
This is why you are just tossing the dice if you ignore the systems desire to run fsck after a crash. You might have no problems, but if the issue really was that innocuous, fsck will have no problems fixing it quickly. Unless... well, unless you have hardware issues that will cause fsck itself to do something unpleasant. Bad ram or a malfunctioning disk controller could cause fsck to inadvertently make things worse. However, under such conditions, running anything, including your application, is also likely to mess things up - perhaps not as spectacularly or as immediately noticeable as what might happen with fsck, but damaged files will almost certainly result.
Don't be afraid to run fsck. If it has problems, you already have things to be worried about.
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Fri Jun 26 13:55:12 2009: Subject: TonyLawrence
Though please do remember that fsck must be run on an unmounted filesystem or (for root) in single-user mode (which means "init 1", not "only one person logged in").
Sat Jun 27 15:19:47 2009: Subject: NickBarron
Ah the handiest command for Apple admins to know, if they only know one is should be this.
fsck -fy in single user mode
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar