External USB disk on /srv formatted as ext4 is being written continuously

Hi all,

I repurposed my Omnia with a new, external USB3 disk and ran into a strange, reproducible problem. When the disk is formatted with ext4 and mounted, some “ghost process” is writing to it continuously. Mounting the file system is enough to trigger this behaviour. Reformatting the disk with btrfs stops this.

Details:

  • I created 2 partitions on the external disk: 1GB for swap, the rest for /srv. I set the configuration and rebooted the router.

  • After reboot the router came up properly. Then I noticed the LED was blinking on the external case - something was using the disk continuously.

  • Indeed, this is what I could see when I ran iostat:

    Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
    sda 4.00 0.00 4096.00 0 4096

  • I checked what processes were using /srv (fuser -c), stopped syslog-ng, but it did not help. Unmounting /dev/sda2 was the only solution.

  • Then I remounted /dev/sda2 - the blinking and writing started again.

  • I unmounted it, blinking/writing stopped.

  • I reformatted /dev/sda2 as btrfs, then mounted it - everything was fine this time!

  • I unmounted the disk again, reformatted /dev/sda2 as ext4, mounted again on /mnt (!), the blinking/writing started again.

Does anyone have any ideas what the hell is going on?

I would say that /srv/ is exactly there for frequent application writes. What process … I dont know

Did you just format and partition the drive? The whole process is done lazily, so you have a usable partition before the process is complete. If the disk is big, it may take a while.

2 Likes

Thanks for the tip, you nailed it! It is indeed ext4 lazy init and a kernel thread was responsible for the constant, lightweight writing. This feature has been in the kernel since at least 2015, considering the date of the blog post I found about it. I just haven’t noticed this with faster/internal storage.

This is precisely what happened to me.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.