Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] How to turn off ext4lazyinit?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Carlosk465
n00b
n00b


Joined: 29 May 2022
Posts: 69

PostPosted: Tue Apr 02, 2024 3:59 pm    Post subject: [SOLVED] How to turn off ext4lazyinit? Reply with quote

I have searched a lot but I did not find the solution, I need to turn off ext4lazyinit so that the system starts faster, when plasma starts it stays stuck for about 3 seconds.

I have read that I need to force it to terminate but this does not work, it keeps starting at the beginning.

I don't like this lazy behavior, how can I disable it? I guess this is the same culprit why the progress bar when copying files doesn't work.

Any file system with which I can format my drive that works without needing "ext4lazyinit" (evidently this is only for ext4 but I suppose other formats will have their equivalent)?


By the way, I have a 2Tb HDD and about 25Gb free, just for data, this is the problematic HDD (I don't even have /home on this disk and it still makes the system slow when starting kde plasma.), because if I remove it it works fine, I have another 120 Gb SSD for the system.
_________________
Sorry for my way of writing, I try to ensure that the translator translates correctly and does not change the words.


Last edited by Carlosk465 on Wed Apr 03, 2024 2:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4169
Location: Bavaria

PostPosted: Tue Apr 02, 2024 4:14 pm    Post subject: Reply with quote

Does this help ?
https://fedetft.wordpress.com/2022/01/23/on-ext4-and-forcing-the-completion-of-lazy-initialization/
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21650

PostPosted: Tue Apr 02, 2024 4:25 pm    Post subject: Reply with quote

According to man mke2fs, you can set lazy_itable_init=0 to instruct that the inode table be initialized immediately. This will make the mkfs slower.

Alternatively, let the kernel finish initializing the inode table. This is a one-time operation. Once finished, it will not need to be done again.
Back to top
View user's profile Send private message
Carlosk465
n00b
n00b


Joined: 29 May 2022
Posts: 69

PostPosted: Tue Apr 02, 2024 4:52 pm    Post subject: Reply with quote

Hu wrote:
Alternatively, let the kernel finish initializing the inode table. This is a one-time operation. Once finished, it will not need to be done again.

I did this, but it didn't take a minute, it still starts every time but after a few minutes it stops appearing in the list of processes. Eeven a simple "ls" takes a long time if I enter through tty.
_________________
Sorry for my way of writing, I try to ensure that the translator translates correctly and does not change the words.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4169
Location: Bavaria

PostPosted: Tue Apr 02, 2024 4:56 pm    Post subject: Reply with quote

Have you done this ?

mount -o init_itable=0 <partition> <mountpoint>
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Carlosk465
n00b
n00b


Joined: 29 May 2022
Posts: 69

PostPosted: Tue Apr 02, 2024 6:16 pm    Post subject: Reply with quote

pietinger wrote:
Have you done this ?

mount -o init_itable=0 <partition> <mountpoint>


Wasn't this the command to finish creating the inodes? It only took a few seconds.
_________________
Sorry for my way of writing, I try to ensure that the translator translates correctly and does not change the words.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21650

PostPosted: Tue Apr 02, 2024 8:31 pm    Post subject: Reply with quote

Yes, it is. How did you determine that inode creation is not finished?
Back to top
View user's profile Send private message
Carlosk465
n00b
n00b


Joined: 29 May 2022
Posts: 69

PostPosted: Tue Apr 02, 2024 10:07 pm    Post subject: Reply with quote

Because I have high disk activity only at power on, then it goes down and the process disappears from the list, I have also checked the file system, I have seen the SMART data. and I can't think of anything else it could be.
_________________
Sorry for my way of writing, I try to ensure that the translator translates correctly and does not change the words.
Back to top
View user's profile Send private message
Adarion
Tux's lil' helper
Tux's lil' helper


Joined: 22 Aug 2005
Posts: 78

PostPosted: Wed Apr 03, 2024 10:39 am    Post subject: Reply with quote

(my 2 cents:)
as far as I know (and always do) during FS creation

# mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 -other-options /dev/...

Other than that, as people wrote, it should be a one time process, so after mounting the FS it will churn on the HDD for a while and then (hopefully) be finished.
Not sure if it can be done also via tune2fs or something.

PS: To speed up things there can also be many other issues and bottlenecks.
setting "noatime" in the fstab mount options can speed up things a little (and saves write cycles on SSDs). One can optimize things during fsck and back in the days of HDDs there was also e4rat (which is not improving things on flash media, though).
But there could also be other things slowing down KDE upbringing.
_________________
stop tcpa, swpatents, corrupt politicians and other scary stuff
Back to top
View user's profile Send private message
tholin
Apprentice
Apprentice


Joined: 04 Oct 2008
Posts: 203

PostPosted: Wed Apr 03, 2024 12:25 pm    Post subject: Reply with quote

the ext4lazyinit kernel thread is used for two things:
* do lazy init of ext4 inoded after mkfs.
* prefetch block bitmaps on every mount so that the block allocator can make better decisions early on.

You are probably seeing the prefetch. This feature was turn on by default in kernel v5.13. If you don't like it you could use the ext4 mount option "no_prefetch_block_bitmaps".

https://github.com/torvalds/linux/commit/21175ca434c5d49509b73cf473618b01b0b85437
Back to top
View user's profile Send private message
Carlosk465
n00b
n00b


Joined: 29 May 2022
Posts: 69

PostPosted: Wed Apr 03, 2024 2:50 pm    Post subject: Reply with quote

tholin wrote:
the ext4lazyinit kernel thread is used for two things:
* do lazy init of ext4 inoded after mkfs.
* prefetch block bitmaps on every mount so that the block allocator can make better decisions early on.

You are probably seeing the prefetch. This feature was turn on by default in kernel v5.13. If you don't like it you could use the ext4 mount option "no_prefetch_block_bitmaps".

https://github.com/torvalds/linux/commit/21175ca434c5d49509b73cf473618b01b0b85437


It worked, now the startup time is super fast, no_prefetch_block_bitmaps was the solution. :D :D :D :D :D
_________________
Sorry for my way of writing, I try to ensure that the translator translates correctly and does not change the words.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum