LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-26-2009, 01:58 AM   #1
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Rep: Reputation: 38
Thumbs up Discussion with all linux champions and guru on How fsck works???


Hi All linux Guru's and linux lovers and all users who loves to live in linux world.Thanks to all for four great work and contributions for linux
and thanks to linuxquestions.org for giving us such a wonderful platform.

Well now come to the point as we all know that fsck is used for file system check and for recovering file systems. We also know that if we want to run fsck on root partition then it should be in unmounted stated first (let me correct if i am wrong). And we also know that fsck recovers file in steps and its around 5 or 6 steps that fsck uses to recover files.

We all have run fsck many times and uses it but still we most of us are not sure how fsck works. What are the steps that fsck uses to recover to file. How fsck recovers block , inodes.

So i really appreciate if someone explain all the working machinism of fsck. So here i want to discuss with all the linux lovers and experts about this. Please give your valuable advice and give your contribution so there there is no more confusion with working process of fsck.

Thanks a lot in advance...

Last edited by vap16oct1984; 07-29-2009 at 02:25 AM.
 
Old 07-26-2009, 02:55 AM   #2
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Well let me discuss few more about fsck
fsck also reports various informations about the allocation of files and directories, giving a detailed count of the amount of disc space that is wasted due to the way files are stored on it.
Generally, fsck is run automatically at boot time when the operating system detects that a file system is in an inconsistent state, indicating a non-graceful shutdown, such as a crash or power loss.

but still confused about its working steps.
 
Old 07-26-2009, 04:16 AM   #3
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Rep: Reputation: 17
Read these articles to get an in depth understanding of how a filesystem works in Linux:
http://www.oracle.com/technology/pub...h_filesys.html
http://www.ibm.com/developerworks/li...ux-filesystem/

Last edited by nathacof; 07-26-2009 at 04:23 AM.
 
Old 07-26-2009, 03:17 PM   #4
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
While this thread is a Linux issue/question, it is not server specific in any way, but more of a general-purpose thread, so I'm moving it to 'Linux - General'

Sasha
 
Old 07-27-2009, 01:44 AM   #5
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Hi Nathacof,
thanks for your useful links. But You have got got my point i have no issue with file systems.

Quote:
Originally Posted by nathacof View Post
Read these articles to get an in depth understanding of how a filesystem works in Linux:
Well here i want to know about the fsck. How does it works and what are the steps of fsck. So i want to discuss all about the great and small things of fsck.

well thanks for your contribution.
 
Old 07-27-2009, 01:50 AM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
As this is Linux, you could try reading the source... if you want to know how it works in depth.
 
Old 07-27-2009, 01:52 AM   #7
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Hi GrapefruiTgirl,
Its better if we talk about the work of fsck.

Quote:
Originally Posted by GrapefruiTgirl View Post
While this thread is a Linux issue/question, it is not server specific in any way, but more of a general-purpose thread, so I'm moving it to 'Linux - General'
Well i don't know how you thinks and why are saying its not a server specific. Can you answer me is fsck command needed on linux servers or not? This is most basic command for all servers and for handling our servers better we must have a god control and depth knowledge of this command. Its one of the very useful command.

Any ways it does not matter how you categorized the things, most important thing is the good and well depth description.
 
Old 07-27-2009, 09:48 AM   #8
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Angry

Quote:
Originally Posted by chrism01 View Post
As this is Linux, you could try reading the source... if you want to know how it works in depth.
Please don't write like this if you don't want to discuss things i my personal advice to you please keep quit and watch all the things.

I would really appreciate you if you give your contributions to the right direction and on the topic. And don't write the things which it out of topic and useless.
 
Old 07-27-2009, 10:06 AM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Dear Mr. VAP;

If you want to get good help at LQ, I advise you to stop criticizing everyone that tries to help you---or moderators that are just doing their job.

1. GrapefruiTgirl was correct in moving this to Linux-General

2. chrism01's advice to look at the source code is actually a good idea. If you need to know how something works in more detail than what the man page provides, then the source code is sometimes the only way.

If you haven't already done so, please tell us what you have learned from a Google search and from the home page for fsck (probably at sourceforge or the Gnu website)
 
Old 07-28-2009, 11:33 AM   #10
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Well I am soory if i heart some one here, its not my intension. What i want is to make the linux world a beautiful place for all Linux lovers. And that is the main reason why i am here. Well i started this thread for this purpose only.
 
Old 07-28-2009, 11:53 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by vap16oct1984 View Post
Well I am soory if i heart some one here, its not my intension. What i want is to make the linux world a beautiful place for all Linux lovers. And that is the main reason why i am here. Well i started this thread for this purpose only.
Cool! I'd like to know a bit more about what fsck does so I hope you'll dig into it and post the results of your research here. Thanks in anticipation
 
Old 07-29-2009, 02:40 AM   #12
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Thanks catkin and deviathan and all linux lovers who read this thread and making contribution towards it. Yes i will share all my ideas with you and hoping your good support for making linux much better for all. Now see some more facts about fsck.

fsck is a Unix utility for checking and repairing file system inconsistencies . File system can become inconsistent due to several reasons and the most common is abnormal shutdown due to hardware failure , power failure or switching off the system without proper shutdown . Due to these reasons the superblock in a file system is not updated and has mismatched information relating to system data blocks, free blocks and inodes .

fsck checks the file system in a series of 5 pages and checks a specific functionality of file system in each phase.

** phase 1 - Check Blocks and Sizes

** phase 2 - Check Pathnames

** phase 3 - Check Connectivity

** phase 4 - Check Reference Counts

** phase 5 - Check Cylinder Groups

fsck should always be run in a single user mode which ensures proper repair of file system . If it is run in a busy system where the file system is changing constantly fsck may see the changes as inconsistencies and may corrupt the file system .

if the system can not be brought in a single user mode fsck should be run on the partitions ,other than root & usr , after unmounting them . Root & usr partitions can not be unmounted . If the system fails to come up due to root/usr files system corruption the system can booted with CD and root/usr partitions can be repaired using fsck

thanks a lot. Hope it will help all and please give your contributions.
 
Old 07-29-2009, 03:46 AM   #13
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
This link provides a bunch more info on those steps (scroll down to 'The Ext2fs tools'). It's from the ext2 days, but in many ways ext4 is still very much the same fs.

vap, strange way to phrase your topic - you're not polling for people's opinions about some subjective thing; you're looking for information about a particular subject. There's nothing wrong with 'I'd like to know how x works.' - that's what these forums are for.
 
Old 07-30-2009, 02:51 AM   #14
squiz
LQ Newbie
 
Registered: Apr 2009
Posts: 15

Rep: Reputation: 0
Quote:
Originally Posted by vap16oct1984 View Post
File system can become inconsistent due to several reasons and the most common is abnormal shutdown due to hardware failure , power failure or switching off the system without proper shutdown
What other reasons are there?
I have a script that backs up a remote system daily using rsnapshot and then shuts down using "shutdown -h now" The filesystem to which I write the backup data often fails the fsck test on boot up. Why would this be? Surely "shutdown -h" cleanly unmounts the filesystem before powering off?
 
Old 07-31-2009, 01:56 AM   #15
vap16oct1984
Member
 
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by squiz View Post
What other reasons are there?
I have a script that backs up a remote system daily using rsnapshot and then shuts down using "shutdown -h now" The filesystem to which I write the backup data often fails the fsck test on boot up. Why would this be? Surely "shutdown -h" cleanly unmounts the filesystem before powering off?
Yes you are shutdown -h cleanly unmounts the filesystem before powering off. Well let me clear few things.
1)Can you share your scripts with us?
2)Here the problem comes in which system i mean either in remote system or in a system in which you runs the script?
3)In which file system you have write backup data?
4)What are the file system that you are using in both systems?
5)You are taking about fsck fails to the check test on boot up. This happens in which system out of two? And how you know that fsck is not
working while booting?

Well its hard to say much more about this before knowing these facts?
So please let me know all these.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 11:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration