How to change file system from ext4 journeying to ext4 writeback ?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
we use SD card in the embedded system, was trying to make sure the data won't get corrupted.
But seems it causes plenty of delay when write data back to SD.
E.g. when we soft reset the board, we try to close all files, was hoping to save all data to SD.
After wait ~5 seconds, we poweroff.
But a lot of times when we boot up, the files are missing.
So our random guess is the ext4 is not writing back to SD and complete its task on time.
Thanks for your reply and we'll try it out.
Quote:
Originally Posted by replica9000
Why is your ext4 filesystem on a journey?
You can mount an ext4 filesystem with the data=writeback option
writeback
Data ordering is not preserved - data may be written into the main filesys‐
tem after its metadata has been committed to the journal. This is rumoured
to be the highest-throughput option. It guarantees internal filesystem
integrity, however it can allow old data to appear in files after a crash
and journal recovery.
So after 5 seconds, if all data hasn't been written yet, you could end up with old versions of the files. You could run the sync command before powering off. That should already happen, unless the embedded system can't shut itself down.
You really need to dismount the filesystem before doing a "reset". You might consider making the "reset" button a software event and do a forced shutdown (there should already be a power failure trap that would do the same thing).
Even with data "writeback", doesn't guarantee that the metadata has been written - and until that metadata is recorded the "data" is not really accessible to the file after a reset. NOTE: Here I'm meaning that the disk cache may have the data - as far as the system is concerned, the data is written--- but a hardware reset could cause the disk to also reset, causing a loss of the cache before it is actually on disk. This really depends on the disk drive involved.
Thanks for the info.
we've tried sync(), umount before, still have issues, all files in the folder with frequent I/Os could all get lost.
Let's see how writeback works.
Quote:
Originally Posted by jpollard
You really need to dismount the filesystem before doing a "reset". You might consider making the "reset" button a software event and do a forced shutdown (there should already be a power failure trap that would do the same thing).
Even with data "writeback", doesn't guarantee that the metadata has been written - and until that metadata is recorded the "data" is not really accessible to the file after a reset. NOTE: Here I'm meaning that the disk cache may have the data - as far as the system is concerned, the data is written--- but a hardware reset could cause the disk to also reset, causing a loss of the cache before it is actually on disk. This really depends on the disk drive involved.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.