LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-08-2014, 11:42 PM   #1
5883
Member
 
Registered: Aug 2004
Posts: 173

Rep: Reputation: 0
How to change file system from ext4 journeying to ext4 writeback ?


we want to change the ext4 mode to writeback,
how should i do that ?
/etc/fstab ?
if so,
what's the exact line pls ?

Thank you !
 
Old 03-09-2014, 07:55 PM   #2
replica9000
Member
 
Registered: Jul 2006
Location: USA
Distribution: Debian, FreeBSD, Android
Posts: 999
Blog Entries: 2

Rep: Reputation: 213Reputation: 213Reputation: 213
Why is your ext4 filesystem on a journey?

You can mount an ext4 filesystem with the data=writeback option. The default seems to be data=ordered
Code:
/dev/sda1 / ext4 defaults,data=writeback 0 1

Last edited by replica9000; 03-09-2014 at 07:59 PM.
 
Old 03-09-2014, 08:01 PM   #3
5883
Member
 
Registered: Aug 2004
Posts: 173

Original Poster
Rep: Reputation: 0
This is what i was looking for.

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 View Post
Why is your ext4 filesystem on a journey?

You can mount an ext4 filesystem with the data=writeback option
Code:
/dev/sda1 / ext4 defaults,data=writeback 0 1
 
Old 03-09-2014, 08:11 PM   #4
replica9000
Member
 
Registered: Jul 2006
Location: USA
Distribution: Debian, FreeBSD, Android
Posts: 999
Blog Entries: 2

Rep: Reputation: 213Reputation: 213Reputation: 213
This is what writeback does:
Quote:
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.
 
Old 03-10-2014, 12:01 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
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.

Last edited by jpollard; 03-10-2014 at 12:05 AM.
 
Old 03-10-2014, 08:30 AM   #6
5883
Member
 
Registered: Aug 2004
Posts: 173

Original Poster
Rep: Reputation: 0
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 View Post
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.
 
Old 03-10-2014, 09:04 AM   #7
brebs
Member
 
Registered: May 2013
Posts: 71

Rep: Reputation: Disabled
I would re-partition, then reformat the SD card. And consider it likely faulty.
 
  


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
add more inodes to ext4 file system bradvan Linux - Server 3 04-06-2012 05:30 AM
OS-X and Linux ext4 file system deadbug Other *NIX 3 07-25-2009 07:11 AM
LXer: The Ext4 Linux file system LXer Syndicated Linux News 0 05-29-2009 06:51 PM
Ext4 File System - Out or Not?? QueenZ Linux - Newbie 12 02-12-2009 05:52 AM
LXer: First benchmarks of the ext4 file system LXer Syndicated Linux News 0 10-21-2006 09:54 PM


All times are GMT -5. The time now is 03:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration