Because it's becoming a common practice to mount filesystems at initramfs time, fsck -a should skip filesystems that are already mounted rw. See bug #415171 for example.
I'll try to hack it and send upstream.
< WilliamH> aidecoe: If you want to implement that, the best way would be to patch fsck and get that sent upstream.
< WilliamH> aidecoe: What I would do is open a bug against linux-utils and ask them to not return an error if you try to check a rw mounted fs.
< WilliamH> aidecoe: but not check anything either.
< WilliamH> So right now, for example, if I do fsck /usr since /usr is mounted it would just return success.
i don't think existing behavior should change. maybe if you added a new flag. but in either case, it should be sent to upstream util-linux list.
Yes, I'm thinking about it as an option -- something like: fsck -a --skip-rw.
sounds reasonable to me
seems to me that you want the -M option
-M Do not check mounted filesystems and return an exit code of 0 for mounted filesystems.
No, because that means that all initramfs's will have to mount /usr ro,
do the fsck on it, then remount it rw instead of just mounting it ro and
allowing the init system to take care of it.
that has nothing to do with this. Amadeusz wanted a flag that would tell `fsck -a` to skip filesystems that were mounted r/w. there's a flag to do that. thus this bug is closed.
what you're describing is a different issue (bug 410605)
Does -M skip file systems that are mounted ro?
If it does, that is no good because we still need to check those.
I just checked, and fsck -M does in fact skip filesystems that are
mounted ro, so this bug is still valid.
I can't add -M to the fsck options in openrc's fsck script because it
would not only skip filesystems that are mounted rw, but the ones that
are mounted ro as well.
What about adding a nice option to /etc/conf.d/fsck like the following?
If it is set to "yes", you would append "-M" option to fsck. This would actually make sense, because if someone wants to use /usr ro-mounted and we rely on whether fs is mounted rw or not, there still would be double fsck of this fs.
(In reply to comment #10)
> What about adding a nice option to /etc/conf.d/fsck like the following?
> If it is set to "yes", you would append "-M" option to fsck. This would
> actually make sense, because if someone wants to use /usr ro-mounted and we
> rely on whether fs is mounted rw or not, there still would be double fsck of
> this fs.
Here is how I see the --skip-rw flag being used:
1) the initramfs comes up.
- if it mounts filesystems rw, it should run fsck on these file systems before it mounts them.
- It does not need to run fsck on filesystems that it mounts ro,.
- This means that if it doesn't mount any file systems rw it does not need fsck at all.
2) The initramfs now hands off to the main init system.
- The init system now runs fsck -a --skip-rw
Where is the double fsck in that setup?
(In reply to comment #11)
> Here is how I see the --skip-rw flag being used:
> 1) the initramfs comes up.
> - if it mounts filesystems rw, it should run fsck on these file systems
> before it mounts them.
> - It does not need to run fsck on filesystems that it mounts ro,.
In  Theodore Ts'o gives quite an insightful explanation on why it is not a good idea to fsck a file system that is mounted ro. (And root being the only exception where to init script must force an instantaneous reboot to ensure file system integrity.)
Realizing that, I would propose a --skip-mounted flag that just silently skips all mounted file systems (regardless of ro/rw)..
.. combined with an initramfs that checks all file systems prior to mounting them. This would also resolve bug 410605 .
OK, so what are we doing with this? Do we still need it? Matthias made a good point.
skip_mounted_fs=yes/no option in OpenRC would solve the issue when we deal with different initramfs generators.
Reassigning to base-system. I don't maintain dracut anymore. I am not sure whether it is still a problem or not. Maybe it can be just closed.