- lvm
- linux
- storage
- debugging
No error, and no disk either. How one missing module hid a disk pool (storage) at boot
Every time a server restarted, some of the disk pools stayed inactive. When activated by hand they worked, and there was no error in any log. Before we found the cause we checked and ruled out three possibilities. The fix turned out to be one line.
The hardest faults are the ones that make no noise. A system that writes an error can be fixed, you read the text, you search, you find it. In our system, though, nothing was writing an error. The server booted, everything was "fine", only some of the disks were not there.
What we were seeing
Our physical servers have two kinds of disk pool, the ones on fast disks and the ones on bigger, slower disks. To speed up the pools on the slow disks, a write cache on a fast disk has been put in front of them.
When a server restarted, the fast pools came up by themselves. The pools on the slow disks, however, stayed inactive. When activated by hand with one command they worked without problems. So the disks were healthy, the data was in place, the system just did not bring them up by itself at boot.
This went on like that for a while. An AI assistant even advised solving it with a ready-made script started by cron, so that the script would activate the pools after boot. We did not agree, because such a script does not remove the cause, it only hides the symptom.
What we checked and ruled out
The first suspect was the disk controller. The slow disks are attached to a separate controller, so we updated its firmware. It did not help.
The second suspicion was a setting. In Linux's disk management system (LVM) every disk group has an "activate yourself at boot" flag. We checked, it was on for all of them.
The third hypothesis was timing, maybe the slow disks appear to the system late and the system does not wait for them. We looked at the log, the disks were connecting in the same second as the others.
Where the difference was
The turning point came when we changed the question. Instead of "What is broken?" we asked "What is different in the structure of the one that works and the one that does not?"
There was one difference. The fast pools consisted of one disk. The slow pools consisted of two, themselves and the write cache in front of them.
From here we found the end of the thread.
When Linux boots, a small initial environment starts before the real system (initramfs). Its job is to find the real system and start it, and it contains only the things needed for that. The automatic activation of disk groups also happens in this initial stage.
The write cache needs a separate module in the kernel, dm-writecache. We looked at which modules were included in the initial environment. Other modules that do similar jobs were on the list, and dm-writecache was not.
So the sequence was this. The initial environment sees the slow pool and tries to activate it. Because the cache module is not there, it fails. But the system already marks this disk group as "seen, looked at". When the real system comes up, the module is available by then, but the system looks at the mark and does not try a second time.
This was also the reason the error was not in the log, the initial environment has no log. The failure was happening, there was just nowhere to write it.
The fix, one line
We added the module's name to the list of modules to be included in the initial environment and rebuilt the initial environment.
echo dm-writecache >> /etc/initramfs-tools/modules
update-initramfs -u -k allThen we restarted one server. All the pools came up without intervention. We applied the same change to the other servers without restarting them, it will take effect at the next boot.
We did not come back to the script idea afterwards either. The cause had been removed, and putting a second mechanism on top of it made no sense.
What this cost us
There was no downtime for customer servers. But it did not pass without harm either.
During the period when one of the pools was "invisible" to the system, a new archive disk had been created. That disk was created not in the pool we intended but somewhere else. The disk usage alert had been red since the day before, and at first we had not connected these two things to each other.
What we learned
The absence of an error message does not mean the absence of an error. Sometimes the failure happens in a place where there is nothing to write it down.
When the question "what is broken?" gets stuck, the question "what is the difference between the one that works and the one that does not?" helps. We ruled out three possibilities, and it was the comparison that gave the answer.
A problem that can be fixed by hand is dangerous, because it is not urgent. You can live for days saying "it activates with one command". And in those days the system keeps making decisions with wrong information.
If you put an extra layer in front of a disk (a cache, encryption or anything else), you need to check that its module is also present in the initial environment of the boot. Having the module in the main system is not enough, because disk groups are activated before that, in the initial environment.