LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices



Reply
 
Search this Thread
Old 08-16-2011, 11:38 AM   #1
niamov
LQ Newbie
 
Registered: Dec 2009
Posts: 10

Rep: Reputation: 0
Understanding ext filesystem and fsck utility


Hello, In order to better use sd card on an embedded arm board running kernel 2.6, I try to understand :

-The difference between ext2 and ext3
-What is doing fsck ? File system check, which is "recommended for data safety". but why is it needed and how is it processed ? This operation is long, is it possible to take care of the file system and then never need to use fsck?
-The usage of fsck is often scheduled each x days or each x mounts. Is it possible to detect when running fsck is required and not running it systematically ?

Today I mount my sdcard with "mount -o async /dev/mmcblk0p1 /mnt/sdcard" on each startup. But sometimes it fails and I have "input/output errors" message when I try to write in sdcard. The idea behind those questions is to make an embedded platform with a sdcard storing pictures, and to be sure to have the best boot time (avoiding to run a long fsck operation on startup)
In worse case, is it possible to process fsck before umount (at system shutdown) rather than after mount (on system startup) ?

Thanks for your explanations/links

Last edited by niamov; 08-17-2011 at 08:40 AM.
 
Old 08-17-2011, 07:01 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
There's a comparison of file systems here. The Wikipedia page for fsck has a little info and some links to more info so it may be useful also.

It's not a good idea to fsck a mounted file system - can you post more info about the errors you're getting please?
 
Old 08-17-2011, 07:09 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
Quote:
Originally Posted by niamov View Post
Is it possible to detect when running fsck is required and not running it systematically ?
Problem with that: A run of fsck is required when the file system is inconsistent. To check if the file system is inconsistent you have to run fsck. So basically you have to run fsck to recognize if a run of fsck is required. This is why fsck is running periodically on a normal Linux system. By the way, if spped is an issue for you you may want to have a look at ext4, its fsck runs far faster than the ones for ext2/3.
 
1 members found this post helpful.
Old 08-18-2011, 05:01 PM   #4
niamov
LQ Newbie
 
Registered: Dec 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you for your answers. I summarize and complete myself:

-The difference between ext2 and ext3 : ext3 = ext2 + journalizing

-What is doing fsck ? It is both checking filesystem and repairing it if necessary.
-Why is it needed ? "Unclean shutdown" can corrupt datas... Is it the only way to corrupt data ?
-How does it repair "inconsistent" filesystem ? I have to investigate further... I understand that inodes and directory structure are checked...

gilead : Yes fsck itself warns that it is better to unmount file system before checking... it is not a problem in my case because my system is running in a jffs2 flash filesystem and my pictures are stored on a separate sdcard formatted in ext2 (or in ext3)
On some files, I have got "input/output errors" when I use ls commands from system and statfs C function on those files returns -1...

I think I will try to process fsck systematically on shutdown (Shutdown time is not as critical as startup time) AND when an error is detected, I will unmount/fsck/remount my sdcard....

Last edited by niamov; 08-19-2011 at 09:21 AM.
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File fragmentation Under ext filesystem Nabeel Linux - Newbie 1 08-11-2011 07:04 AM
Commit interval ext filesystem vs dirty_expire_centisecs SvenVD Linux - Kernel 1 03-11-2011 05:25 PM
How to see ext 3 filesystem on WinXP? M$ISBS Linux - Software 15 02-24-2011 07:20 AM
ext filesystem limits? BeacoN Linux - Newbie 6 07-01-2009 09:44 AM
Understanding fsck.ext3 errors - Inode X is too big. Truncate? DigitalMagnets Linux - Hardware 3 10-03-2007 11:07 AM


All times are GMT -5. The time now is 11:35 PM.

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