LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 10: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, 06:55 PM   #2
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
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 06:59 PM.
 
Old 03-09-2014, 07: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, 07:11 PM   #4
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
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-09-2014, 11:01 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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-09-2014 at 11:05 PM.
 
Old 03-10-2014, 07: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, 08:04 AM   #7
brebs
Member
 
Registered: May 2013
Posts: 89

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:53 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
Open Source Consulting | Domain Registration