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.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi we have a customer designed arm9 board,
it has a software reset button.
when i press it, it'll trigger a configuration backup function,
which will save all my running configuration from ram disk to SD/EMMC card, using "cp" command.
In the end of the cp commands, i run "sync()" to make sure all stuff put back to SD or EMMC. Then board reboots.
Now after i reboot, i copy my original config from SD/EMMC to ram disk.
Every once a while it says inode problem, asking me to run e2fsck.
If i put several sync() in the code back to back, problem happens less but still happens.
my guess is it didn't write info to SD/EMMC completely during soft reset.
so how to make sure sync() can really flush info to the SD ?
thanks for reply 1st,
check code again, we are doing system call actually,
system("sync");
my understanding is system() will guarantee "sync" completes and then return back.
system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed.
Quote:
Originally Posted by smallpond
If you run sync from the command line, it waits for all writes to disk before it returns.
If you run the sync() C library procedure, then according to the documentation:
If the filesystem is still mounted read/write there is no assurance that the filesystem metadata has been written to the device. If the filesystem cannot be unmounted, you should at least remount it read-only before rebooting.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.