2

After using a write-around bcache on the root device of an old laptop for more than a year (HD + SD card), I finally found out that some severe filesystem corruptions I was facing -- which lead me to resort to backups and reinstall everything twice (!!) -- were due to bcache corruption on the cache device after rebooting uppon updating/upgrading the kernel.

The workaround for that is rather "easy", since it is a read cache: When the boot process says my device is corrupted beyond automatic repair habilities, I just have to remove the cache device before doing a manual fsck, recreate the cache and register it again. -- BTW, never try to fsck an allegedly corrupted file system with a corrupted write-around bcache because, then, you will really corrupt your data.

Question: what would be a possible way to prevent this corruption? I use archlinux, therefore, always with a recent version of everything -- the kernel now is 4.19.4.

0

I found a workaround which proved itself over several updates in several machines already:

After the normal system & kernel upgrade, before the reboot, simply stop bcache:

echo 1 >/sys/fs/bcache/*/stop;sleep 2;sync;sync;shutdown -r now;logout

On the next reboot, bcache will be back on without any corruptions.

Most certainly bcache doesn't change its format from kernel version to kernel version, but the fact is: rebooting the machine without kernel updates don't corrupt bcache's caching device while updating the kernel does. Even if it is a minor update.

| improve this answer | |
  • I'm amused by the shutdown -r now; logout combination :) – Jeff Schaller Mar 2 '19 at 13:44
  • Just a little trick to save the session commands on the shell's command history – zertyz Mar 2 '19 at 19:27

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.