Timeline for How to keep the kernel from accessing the journal on an ext4 partition?
Current License: CC BY-SA 4.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 22, 2022 at 15:59 | comment | added | Binarus | @cas I am not sure whether the sort of installation you propose wouldn't produce the same problem. But thanks for the tip, I'll try it out of curiosity. | |
| Jun 22, 2022 at 15:57 | vote | accept | Binarus | ||
| Jun 22, 2022 at 13:00 | answer | added | steve | timeline score: 1 | |
| Jun 22, 2022 at 11:42 | comment | added | cas | why do you think you need to install debian in a VM using debootstrap? it's better AND easier to just install from a CD/DVD image .iso file. debootstrap's fine for a chroot or container, but a VM should have a proper install just like a physical machine. | |
| Jun 22, 2022 at 10:30 | comment | added | Binarus | @steve Your first suggestion seems to have mitigated the problem. Thank you very much! When I consequently use -o norecovery, the host kernel does not put its hands on the ext4 partition's journal, and there are no jbd2/sdc entries any more in the output of lsof. If you make your comment an answer, I'll accept it. Besides that, I guess that the debian kernel is buggy: I still even can't e2fsck that partitions as soon as I have mounted and unmounted it, but at least it doesn't damage the file system any more. | |
| Jun 22, 2022 at 10:24 | comment | added | Binarus | @Vilinkameni There are multiple reasons to not use mount -B: It does not not bind recursively, and nowadays it does a shared bind (instead of the usual private bind) due to some changes in systemd, which is fatal in use cases like the one described above. For more information, see wiki.debian.org/systemd#Known_Issues_and_Workarounds | |
| Jun 22, 2022 at 10:18 | comment | added | Binarus | @Vilinkameni mount as well as /proc/self/mountinfo as well as /proc/self/mounts did not output / contain an entry relating to the partition or directory in question. Neither did lsof or fuser. I believe that I am a victim of that kernel bug. debian buster comes with 4.19 with debian patches. | |
| Jun 22, 2022 at 9:20 | comment | added | Vilinkameni | Also the comments in this question seem to suggest this might be a kernel bug or related to mount namespaces. What does the /proc/self/mountinfo show? | |
| Jun 22, 2022 at 9:05 | comment | added | Vilinkameni | Is there a reason why --rbind and --make-rslave and double calls of mount for each mountpoint are necessary instead of single mount calls per mountpoint with a simple -B? That might be causing the issue. | |
| Jun 22, 2022 at 7:18 | comment | added | Binarus | Yes, as described in my post, I did find out that there is a host kernel thread jbd2/sdc even after the file system has been dismounted; I was using lsof to find that out. This means that the host kernel accesses the journal of that ext4 file system even after it has been unmounted. | |
| Jun 22, 2022 at 7:14 | history | edited | Binarus | CC BY-SA 4.0 | added 606 characters in body |
| Jun 22, 2022 at 7:11 | comment | added | Vilinkameni | You can try using lsof(1) to find out what process is using specific files. | |
| Jun 22, 2022 at 7:09 | comment | added | Binarus | @Vilinkameni The problem is that I can't even run e2fsck on that partition because e2fsck claims that it is in use after unmounting it. That was what put me on the right track regarding the cause of the problem ... | |
| Jun 22, 2022 at 7:06 | comment | added | Binarus | @Vilinkameni The weird thing is that umount did not give any errors. Maybe the problem is due to the rbinds? I'll update my question to show them exactly. | |
| Jun 22, 2022 at 7:05 | comment | added | Vilinkameni | Also, run e2fsck -p /dev/sdc1, where /dev/sdc1 is the guest's partition, on the host when it is not mounted and not used by QEMU. | |
| Jun 22, 2022 at 7:05 | comment | added | Binarus | @steve Thanks for your suggestions. The first one looks promising. However, I am still asking myself why the host kernel grabs that journal even after having dismounted the partition. I don't want to dump the journal completely, though. I'll try your first suggestion and report back. | |
| Jun 22, 2022 at 7:00 | comment | added | Vilinkameni | Did the umount command give any errors? Basically, what you described shouldn't happen if the partition was successfully unmounted. | |
| Jun 22, 2022 at 7:00 | comment | added | steve | Or just bin the journal altogether? tune2fs -O ^has_journal /dev/sdXY | |
| Jun 22, 2022 at 6:55 | comment | added | Binarus | Of course, I exited the chroot and unmounted the partition before starting the VM. The problem is that the host kernel nevertheless puts its hands on the journal. Therefore, I even can't do e2fsck on that partition after having it unmounted. I even can't create a new ext4 file system on that partition after having it unmounted! | |
| Jun 22, 2022 at 6:51 | comment | added | Vilinkameni | After installation, make sure to exit chroot, umount the partition you installed the guest OS on and then start QEMU. There is no need for it to be mounted on host after you finish installation. | |
| Jun 22, 2022 at 6:49 | comment | added | steve | Pass -o norecovery to mount ? | |
| Jun 22, 2022 at 6:44 | history | edited | Binarus | CC BY-SA 4.0 | deleted 1 character in body |
| Jun 22, 2022 at 6:32 | history | asked | Binarus | CC BY-SA 4.0 |