Tool for viewing status of ext4 journal entry queue/backlog

Sometimes "sync" is quick, other times it is very slow, and the difference can't be explained, in my view, for my activity context.

Is there a tool which would give ongoing visibility of a selected partition's queue/backlog of the ext4 journal entries?

It looks like you are interested in

$ grep 'Dirty\|Writeback' /proc/meminfo
Dirty:               408 kB
Writeback:             0 kB
WritebackTmp:          0 kB
  • Dirty: Memory waiting to be written back to disk
  • Writeback: Memory which is actively being written back to disk
2 Likes

I thought "Writeback" was the backlog of data (in memory) that needs to be written into the disk's EXT4 journal, not the backlog of memory going from journal to a "permanent" inode.

Is that not so?

The source of the cited information is
https://www.kernel.org/doc/Documentation/filesystems/proc.txt

I think that Writeback & Dirty are filesystem-independent parameters of kernel-related caching and buffering activity.

1 Like

Thank you, Eugene. I read that.

Writing to Journal is my interpretation of the "Writeback" scope. I don't perceive it as encompassing migrating that to its block of permanent residency.

Also, I think the answer may lie somewhere in this document, but that is way over my head. :frowning:

But I also found this reference pointing to "/etc/systemd/journald.conf". I am very leery of any tinkering with that file and, given what is said here, I don't really see any point in tinkering with that.


----- edit -----

I think the method provided here is what I was looking for, because it offers a way to get the "queue" on a per partition basis. :slight_smile:

Script to monitor:

#!/bin/bash


####################################################################################################
###
###	Script to monitor ongoing backlog for journal commit of EXT4 partitions on ROOT drive
###
###	FUTURES:   Rework with options and logic to allow choice of ROOT drive and BACKUP USB drive
###
####################################################################################################

scan_interval=5

###
###	Path to root hard drive
###
dev=$( df / | grep '^/dev' | awk '{ print $1 }' | cut -f3 -d/ | sed 's+[0-9]++g' )

physDev="/sys/block/${dev}"
prefDev=$(basename "${physDev}" )

cd "${physDev}"

details=$( mount | grep "/${dev}" | grep 'ext4' | awk '{ print $1, $3 ; }' | sort --version-sort )

#listDev=$( echo "${details}" | grep "/${dev}" | awk '{ print $1 }' )
#echo "${listDev}"
#baseDev=$( echo "${listDev}" | sed 's+/dev/++' )
#echo "${baseDev}"

printf "\n Partitions identified on ROOT device:\n"
echo "${details}" | awk '{ printf "\t %-12s %s\n", $2, $1 }END{ print "\n" }'

#	$( s -d ${prefDev}* | sort --version-sort )
while [ true ]
do
	date
	printf "\n\n Journal queue per partition:\n"
	echo "${details}" | sed 's+/dev/++' |
	while [ true ]
	do
		read part label
		test $? -eq 0 || exit
		###
		###	Report value #9 of /sys/block/${dev}/${part}/stat
		###
		cat "${physDev}/${part}/stat" | awk -v lab="${label}" '{ printf("%15d  %-12s\n", $9, lab ) ; }'
	done
	sleep ${scan_interval}
	clear
done

P.S. Version to selectively choose between ROOT and BACKUP USB device has been finalized and is available from my GitHub repository. :slight_smile:

1 Like