Linux - Embedded & Single-board computerThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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) ?
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.
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....