You are not logged in.
Hello,
My question is regarding the mount options set in initramfs vs the mount params set by "/etc/fstab". I expect that after the kernel boots, the mount options should always be those specified by fstab, and not those specified to the initramfs image. However, this doesn't seem to always be the case.
I'm running a btrfs system under dm-crypt (with LUKS) with UEFI as well as gummiboot (/boot is on ESP).
Initially, both the gummiboot conf and fstab have the same mount params, I will post them here for reference.
Gummiboot conf contains:
options root=UUID=<UUID> rootfstype=btrfs ro rootflags=ro,noatime,ssd,discard,space_cache,autodefrag,subvol=root cryptdevice=PARTUUID=<PARTUUID>:cryptroot:allow-discards cgroup_disable=memory add_efi_memmap
fstab has:
UUID=<UUID> / btrfs rw,noatime,ssd,discard,space_cache,autodefrag,subvol=root 0 0
The way I understand it is that the options specified by gummiboot (which can be seen in the kernel with cat /proc/cmdline) are the mount options that the '/' partition on initramfs will be mounted with. But when the "real" kernel runs (and eventually reads its fstab), it will [somehow] remount the '/' partition (similar to how mount -o remount works?) with the options specified by /etc/fstab. Is this incorrect?
If I add the "compress=lzo" option to initramfs's rootflags (and not to fstab), I do see the option if I run the 'mount' command. This leads me to think that the fstab line got ignored (at least the part where it omits compression), and the mount options given to initramfs's rootflags are staying after booting the "real" kernel.
If I however, add "compress=lzo" to the fstab options (and not to initramfs), and check the mount options in the kernel post-boot (by just running the "mount" command), I also do indeed see "compress=lzo" as an option, which means that in this case, the option specified by fstab did take effect.
Is it possible that the mount options in fstab are additive over the mount options in initramfs instead of overriding them?
I also observed that if I mount ro in initramfs, the fstab option of rw takes precedence. And if I mount ro in fstab and rw initramfs, the rw takes precedence. In other words, in both cases, the option specified in fstab takes precedence here. Why does it not take precedence for all options? Is this actually intended behavior documented somewhere?
Any insight on what's going on?
Edit: marked as solved
Last edited by banana_pancakes (2015-06-13 12:47:08)
Offline
Not every mount option can be changed on the fly with a remount. I'm not familiar with btrfs or its options, but try to remount it yourself and see if it works or not.
Also check /proc/mounts which is sometimes more accurate than 'mount' output.
Offline
Thanks for the tip!
I just tried manually remounting, and that works properly. Except that to remove the compression, and since the re-mounting options are indeed additive, I have to explicitly pass "compress=no":
mount -o remount,compress=no /
Therefore I tried explicitly adding "compress=no" to "/etc/fstab", and that worked properly! The compression option now goes away from /proc/mounts (or "mount") even if it was specified for the initramfs.
Lesson learned: Remount options are additive not only when manually remounting with mount -o options, but also when being executed from /etc/fstab over the initramfs mount options. In other words, the options specified in "/etc/fstab" should not be viewed as the final options, but they should be viewed as a modification of initramfs's, which remain relevant. This also makes all the explicit "no" options more useful since we sometimes need to oppose mount options set for initramfs.
Note: It is also possible to not have an entry in /etc/fstab for "/" at all, if the options set for initramfs are satisfactory. Although explicit is often better than implicit, so that's probably not recommended.
I will mark this thread as [solved] in a couple of days in case people have additional comments.
Last edited by banana_pancakes (2015-06-07 06:24:26)
Offline
Please don't mark the thread [closed] (that is for threads that have been closed by a moderator.) Mark it [solved] if you are happy with your solution.
(edit) I see you changed your post. Thank you.
Last edited by 2ManyDogs (2015-06-07 06:28:39)
Offline