Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 415249 - sys-apps/util-linux: fsck -a should skip fs mounted rw already
Summary: sys-apps/util-linux: fsck -a should skip fs mounted rw already
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on: 410605
Blocks:
  Show dependency tree
 
Reported: 2012-05-09 14:44 UTC by Amadeusz Żołnowski (RETIRED)
Modified: 2017-05-28 13:45 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amadeusz Żołnowski (RETIRED) gentoo-dev 2012-05-09 14:44:41 UTC
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.

Reproducible: Always
Comment 1 Amadeusz Żołnowski (RETIRED) gentoo-dev 2012-05-09 14:46:33 UTC
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.
Comment 2 SpanKY gentoo-dev 2012-05-09 17:13:28 UTC
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.
Comment 3 Amadeusz Żołnowski (RETIRED) gentoo-dev 2012-05-09 17:16:54 UTC
Yes, I'm thinking about it as an option -- something like: fsck -a --skip-rw.
Comment 4 SpanKY gentoo-dev 2012-05-09 21:50:09 UTC
sounds reasonable to me
Comment 5 SpanKY gentoo-dev 2012-05-14 04:37:46 UTC
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.
Comment 6 William Hubbs gentoo-dev 2012-05-14 16:22:20 UTC
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.
Comment 7 SpanKY gentoo-dev 2012-05-14 17:12:53 UTC
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)
Comment 8 William Hubbs gentoo-dev 2012-05-14 19:32:48 UTC
Does -M skip file systems that are mounted ro?
If it does, that is no good because we still need to check those.
Comment 9 William Hubbs gentoo-dev 2012-05-14 19:48:43 UTC
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.
Comment 10 Amadeusz Żołnowski (RETIRED) gentoo-dev 2012-05-15 07:31:12 UTC
What about adding a nice option to /etc/conf.d/fsck like the following?

skip_mounted_fs=yes/no

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.
Comment 11 William Hubbs gentoo-dev 2012-05-15 16:07:56 UTC
(In reply to comment #10)
> What about adding a nice option to /etc/conf.d/fsck like the following?
> 
> skip_mounted_fs=yes/no
> 
> 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?
Comment 12 Matthias Maier gentoo-dev 2013-02-05 14:30:47 UTC
(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 [1] 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 .
Comment 14 Amadeusz Żołnowski (RETIRED) gentoo-dev 2013-07-06 16:57:15 UTC
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.
Comment 15 Amadeusz Żołnowski (RETIRED) gentoo-dev 2017-05-28 13:45:59 UTC
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.