Constant disk activity on ext4 TB size drives

Forum Forums General Tips and Tricks Constant disk activity on ext4 TB size drives

  • This topic has 2 replies, 3 voices, and was last updated Mar 18-8:03 am by ModdIt.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #79116
    Member
    Robin

      If you ever have been in doubt what goes on with your freshly ext4-formated harddrive (of a size of some TB), showing constantly disk activity by blinking its LED, your antiX writing to and reading from the drive for hours and hours again: This behaviour is normal. It will stop eventually after the culprit, a hidden helper tool of ext4 has completed its work.

      You also could file the question differently:
      What the heck is ext4lazyinit and why should I know it? What should I know about it?

      Firstly you won’t guess there is running this process, since it is not shown in htop or system information. So you won’t have a clue whats going on, in some hardware setups powering up your CPU to 100% for hours. You even could think of a virus…
      Well, actually you need to start iotop instead, to see its activity.

      Secondly: What is this ext4lazyinit thing good for?
      Obviously it is a design decision of the mkfs.ext4 creators. The ext4 file system expects to overwrite all nodes on a freshly formated drive by zeros. This zeroing is performed in order to make sure there are no outdated inodes or zombie records left on the drive, which won’t do any harm in normal operation, but cause a restore of a damaged filesystem to fail later on occassionaly. In the old days, when drive capacities were small (and physical measure them were big), this task was performed during formating completely. But on the large drives of our days it would take some additional 10-20 minutes, depending on the size of your drive. So they decided to let this task wait until first mount of the file system instead, this way speeding up the formatting process itself. Once the file system is mounted first time, this task will be performed in background, using around 10% of the drive transfer capacity for this only, allowing you to use your drive and system already, while the zeroing goes on.

      What can be done about it? Simple answer: Nothing. You’ll just have to wait until ext4lazyinit has finished its task. Then the activity stops and the system load goes back to normal. You can use your system and your drive already normally. OK, for the cracks among us there is a way to force ext2fs to perform this zeroing task during formatting already when using a command line switch, but this is not the case when using the antiX installer or gparted for creation of file systems. These will use the defaults of ext2fs, so you will experience this disk activity on first mount, and in case you u(n)mount the drive before finnishing the task even on next mounts still.

      So when experiencing strange disk activity on a freshly installed antiX system (which by default formats the drive), you should check whether this ext4lazyinit tool is the culprit, before thinking of journaling, timestamping, swapping, drive failure, or whatever else well known reasons.

      Btw, this happens also on smaller sized drives, but it will finish much faster on them, so you probably won’t notice is activity on those smaller drives at all.

      Additional hint:
      Unfortunately on a 32bit single core system this ext4lazyinit process works poor, powering up your CPU usage to 100% for the time it is running, which can take some hours as said before. No good idea on a notebook, it might run out of battery power, or even overheat, since these devices (different to big desktop PCs) are often not designed to run for hours on 100% load.

      More details and deeper research source links:
      Lemma about ext4-filesystem on Thomas Krenn wiki

      Windows is like a submarine. Open a window and serious problems will start.

      #79177
      Member
      calciumsodium
        Helpful
        Up
        0
        ::

        Hi @Robin,
        Thank you for the detailed explanation on ext4lazyinit.

        A while back, after an install of antiX21 runit, I used that runit-service-manager to turn off all the services that had high disk write issues. Then I noticed that the only three disk writes came from kworker, jbd2, and ext4lazyinit using sudo iotop -o. After a while, the ext4lazyinit would go away.

        Also after an install of antiX21 sysvinit, I also see the ext4lazyinit disk writes. Again, the ext4lazyinit writes would go away after a while.

        Now I know how ext4lazyinit works.

        Xecure once explained that kworker has something to do with the kernel.

        I am not sure about jbd2.

        #79291
        Member
        ModdIt
          Helpful
          Up
          0
          ::

          Thanks Robin,
          on a fast freshly formatted 1 TB drive the ext4 process was busy for a while,
          before reading your post I put it down to being related to scrubbing the disk
          of user data with dd random overwrite.

          @calciumxodium:
          jbd2 is a kernel thread that updates the filesystem journal so normal activity.

          For further reading pls take a look at.
          https://www.kernel.org/doc/html/latest/filesystems/journalling.html

          OT NOTE:
          dd is a wonderful tool. But users please be careful, it is nicknamed data destructor
          for a reason. it follows your commands. No asking, are you absolutely and totaly
          certain you want to overwrite the boot disk.

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.