i need to know which partitions have has_journal flag enabled

i know i can run

tune2fs -l /dev/block/sda1 | grep features

is there a way i can check all partitions in /dev/block* and only list those that have has_journal flag?


You could create a simple for loop:

for d in /dev/block/*; do
  [[ $(tune2fs -l ${d} 2>/dev/null | grep -c has_journal) -gt 0 ]] && echo ${d}

This will loop through all items in /dev/block. It will run tune2fs -l on it and pipe the output to grep. If the output has has_journal in it anywhere, it is considered a match. If there is a match, it will print out the /dev/block filename.

You can expand on this to convert the /dev/block name into the actual filesystem path, mount point, etc.

Hope this helps.

  • 1
    @ShadyPaz, You may need to run this with elevated permissions, sudo, because of tune2fs
    – sudodus
    Nov 14 '18 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.