Is there any way to 'force' ext4lazyinit to finish the thing it does with maximum priority? Something like "I don't care about my system's ressources, just do your job as fast as you can"?

I should add: Without reformatting the drive. I am aware of mkfs's lazy_itable_init option.

  • Sounds pretty XY to me. What are you actually trying to achieve? – Daniel B Jul 18 '14 at 8:18
  • 4
    It took my Raspberry Pi multiple hours to finish ext4lazyinit on an external hard drive. I wanted to test if the hd spins down correctly after some time of inactivity however that wasn't possible due to ext4lazyinit. After looking at some kernel code (github.com/torvalds/linux/blob/master/fs/ext4/super.c#L2931) it seems not possible to force the thread to finish since the delays are somewhat hardcoded. That is however no definitive answer, I am no kernel nor ext4 expert and I just took a glimpse at that function. – Marius Jul 18 '14 at 9:29
  • @Marius You are correct that the delay is hard-coded. – Moshe Katz Sep 14 '16 at 18:49

In order to 'force' ext4lazyinit to finish the thing it does with maximum priority, you need to mount the filesystem with 'init_itable=0'. By default it is 10 (for detail please see link below)

Alternative solution is to disable the ext4lazyinit thread by mount option 'noinit_itable' which may however not be a good idea on production system (for detail please see link below).

Source with detailed info here ext4lazyinit git commit comment.

  • 2
    To get command that can be used to remount (without off lining) you can run mount | grep /path/to/mount/point | sed -E 's/^.* on (.*) type ext4 \((.*)\)$/mount -o remount,init_itable=0,\2 \1/g' - This will output something like mount -o remount,init_itable=0,rw,noatime,seclabel,stripe=512,data=ordered /path/to/mount/point – Iwan Aucamp May 14 '18 at 20:05
  • Thanks init_itable=0 was the answer I was looking for. – Melroy Nov 8 '20 at 3:59

You can set the 'nice' level of the process to a higher priority over others. Not sure if it will make it go any faster though and could adversely affect system stability if set too high (-20 is the highest priority).

nice -n [nice value] [command]
  • 2
    nice would be giving it more CPU priority, what it needs is more IO priority, @VencaBSpam has the right solution – Jens Mühlenhoff Mar 14 '18 at 0:17

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.