LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why use fsck? (http://www.linuxquestions.org/questions/linux-newbie-8/why-use-fsck-944100/)

svenxix 05-09-2012 12:39 PM

Why use fsck?
 
When and why would I need to run fsck?

My understanding is that fsck can be used when a files data and meta-data are inconsistent. But I understand that fsck can take a really long time.

What is the harm in losing a little metadata (such as access time and created time) on a few files?

What other problems can be caused by a few inconsitent files?

There is plenty of documentation on how to use fsck, but I am more interested on knowing when and why I should use it.

Nermal 05-09-2012 12:58 PM

fsck is like scandisk. It checks that the file system is correct and you have no loose data nodes (lost data). On my servers I run a fsck every 6 months(ish) just to make sure that all is well in the world. I can't remember the last time anything was fixed by it.

My servers at home run 24/7 unless I have a power outage greater than 20 minutes, my ups's are rated for 30 mins but I do like to shut things down nicely, some of my databases can take 5 mins to commit and shut down.

Work wise my servers are customer facing and I have a strict quarterly process to power down and bring each server back up after full backups and cleaning up stuff that shouldn't be their. I have over 100 servers in my estate 90%/10% split *nix and Windoze.

So in short it does a File System Check. Good for checking the file system is good.

Kustom42 05-09-2012 03:57 PM

You should always ALWAYS make a backup before running fsck. Especially if you run it with -y(not advisable in most cases), it does have a potential to make data irrecoverable depending upon the errors in the filesystem. As with anything, backup before you run a command.

unSpawn 05-09-2012 04:57 PM

Quote:

Originally Posted by svenxix (Post 4674439)
What is the harm in losing a little metadata (such as access time and created time) on a few files?

Apart from "creation" time not existing in Linux (it's "change" time): a file ("everything is a file") may be polled by a process waiting to Do Something based on say modification time. Change time is for instance used by the 'dump' utility.


Quote:

Originally Posted by svenxix (Post 4674439)
What other problems can be caused by a few inconsitent files?

Think of the results as the computer equivalent of amnesia an epilepsy combined. Basically everything that can fail will. On a small level that may just mean you not being able to open your previous OGG, MKV or SVG files, or your smartphone no longer working or on a larger level Gmail or Yahoo mail serving you your emails but partially mixed with somebody elses emails or critical infrastructure failures and I don't mean just the Internet.


All times are GMT -5. The time now is 01:51 PM.