On Tue, Apr 18, 2017 at 9:13 PM, Chris Murphy <lists@colorremedies.com> wrote:
On a journaled filesystem, data and journal only are committed with sync(). You have to umount or remount readonly to get all filesystem metadata to commit.

After sync () it's expected you can crash, and the filesystem will be made consistent at next remount when the journal is replayed.

If anything tries to find files with data committed, journal committed, but fs metadata not committed: such as GRUB or debug tools, they will fail.

Another option is to freeze/unfreeze. That was originally an XFS feature, but is now generic capability. What I'm not totally sure about off hand is whether the XFS user space tools is what to use for any filesystem,  I'm pretty sure that it is.


Chris Murphy

​Could you explain what the journal is holding: The User Data, the Metadata, or Both?
If both, should not a sync clear the contents of the journal after the completion of a sync (assuming no other io operation was done after the sync)?
If not both (i.e. ONLY metadata), then replaying the journal only preserves the metadata that describe the files (name, mode, ...etc).

Another question: What if the FS is mounted with the SYNC option in fstab, such as:
UUID=71af3828-c4cd-2d26-b1f7-8337def05b8c   /sdd1   ext3 sync,rw     0 0

Would that cause immediate commit of the DATA, or would that cause the commit of the METADATA?

Thanx!