LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-31-2018, 02:56 PM   #1
pitm0d
LQ Newbie
 
Registered: Oct 2018
Posts: 3

Rep: Reputation: Disabled
Ext4 sync or async


Hi,
is ext4 filesystem sync or async by default. Shall I explicitly set async mount option to make it perform I/O writes in asynchronous way?
BR,
 
Old 10-31-2018, 04:58 PM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
I think all disk filesystems (including ext4) are basically async, so no specifier is necessary.

async / sync are really only relevant for remote I/O.
 
Old 10-31-2018, 05:01 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
According to the generic mount man page, you can’t say that for sure:
Code:
       Some of these options could be enabled or disabled by default in the
       system kernel.  To check the current setting see the options in
       /proc/mounts.  Note that filesystems also have per-filesystem
       specific default mount options (see for example tune2fs -l output for
       extN filesystems).
Also note the commit mount option:
Code:
commit=nrsec	(*)	Ext4 can be told to sync all its data and metadata
			every 'nrsec' seconds. The default value is 5 seconds.
 
Old 11-04-2018, 11:12 AM   #4
pitm0d
LQ Newbie
 
Registered: Oct 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Dumpe2fs/tune2fs -l doesn't show if it's sync or async.
 
Old 11-04-2018, 07:35 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by pitm0d View Post
Shall I explicitly set async mount option to make it perform I/O writes in asynchronous way?
All write are done in an apparently synchronous way.

For truly asynchronous I/O, applications have to be sufficiently sophisticated to manage multi-threaded sleep and respond to I/O completion events. Not many are that sophisticated - almost all just leave it to the operating system.
What are you really asking ?.

Perhaps read this before responding.

Last edited by syg00; 11-04-2018 at 07:38 PM. Reason: sp
 
Old 11-04-2018, 08:59 PM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
To come back to your original question:
Quote:
Originally Posted by pitm0d View Post
Shall I explicitly set async mount option to make it perform I/O writes in asynchronous way?
The manual page for ext4 doesn't mention any sync or async mount options. This explains why no such option appears in the output of tune2fs.

Regarding the behaviour of ext4, I suggest you look at the commit and data options in the ext4 man page. By default, data is sync'ed every 5 seconds. For more asynchronicity (is that a word?) set data=writeback, or change the commit value to a larger time interval.

You may also want to read this LWN article about ext4 and data loss.

Thanks for the question, by the way. It forced me to research the subject and learn something.

Last edited by berndbausch; 11-04-2018 at 09:05 PM.
 
Old 11-05-2018, 10:42 AM   #7
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
The hardware won't necessarily physically obey the async/sync "preference".
For example a SATA disk will normally accept writes in the order it receives them, but they will be executed in the order it considers to be most efficient.
You will get this happening with any hardware that has a cache.

It's possible for the OS to instruct the device that certain I/O is to be carried out synchronously though...

The sync command might be relevant, if you need internal caches to be rolled out to disk.
 
  


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
[SOLVED] /etc/fstab options: dev / nodev, sync/async gacanepa Linux - Newbie 5 08-23-2013 02:41 PM
[SOLVED] Is my data safe after running "sync" if I use data=writeback,barrier=0 (ext4)? *Dark Dragon* Linux - General 4 01-11-2012 02:25 PM
No 'sync' or 'async' option specified for export ":ÿ". cccc Linux - Networking 2 05-31-2007 05:31 PM
want to mount removable disk as async not sync tkalfaoglu Linux - Software 3 02-10-2006 06:34 AM
sync and async serial of Routers whepin General 0 11-06-2002 07:38 PM

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

All times are GMT -5. The time now is 04:39 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