How to change mount options of root device?
Hello, System is a Leap 15.5. I try to change the mount options of the root device (here: /dev/sda4 mountetd on /). I changed the options in the fstab and built the initrd via "mkinitrd". But after a reboot, the partition is mounted like before. Any ideas what I'm doing wrong here? Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 https://www.marco.de Email ds@marco.de Geschäftsführer Martin Reuter, Torsten Lukas HRB 171775 Amtsgericht München
On Wed, May 31, 2023 at 8:54 AM Daniel Spannbauer <ds@marco.de> wrote:
Hello,
System is a Leap 15.5. I try to change the mount options of the root device (here: /dev/sda4 mountetd on /).
I changed the options in the fstab and built the initrd via "mkinitrd". But after a reboot, the partition is mounted like before.
Any ideas what I'm doing wrong here?
No. Show cat /etc/fstab cat /proc/cmdline findmnt / mkinitrd
Am 31.05.23 um 08:30 schrieb Andrei Borzenkov:
No. Show
cat /etc/fstab cat /proc/cmdline findmnt / mkinitrd
/etc/fstab: https://paste.opensuse.org/pastes/444091fdc0a5 /proc/cmdline: BOOT_IMAGE=/vmlinuz-5.14.21-150500.40-default root=UUID=d3cf2dfe-2297-4c1c-a7f5-422dd2215996 splash=silent resume=/dev/disk/by-uuid/e3501661-f64a-4f0b-9a68-f8539f96aa1b preempt=full mitigations=auto quiet security= findmnt /: TARGET SOURCE FSTYPE OPTIONS / /dev/sda4 ext4 rw,relatime Output of mkinitrd: https://paste.opensuse.org/pastes/7ef8da64bac4 Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 https://www.marco.de Email ds@marco.de Geschäftsführer Martin Reuter, Torsten Lukas HRB 171775 Amtsgericht München
On Wed, May 31, 2023 at 11:05 AM Daniel Spannbauer <ds@marco.de> wrote:
Am 31.05.23 um 08:30 schrieb Andrei Borzenkov:
No. Show
cat /etc/fstab cat /proc/cmdline findmnt / mkinitrd
/etc/fstab: https://paste.opensuse.org/pastes/444091fdc0a5
UUID=d3cf2dfe-2297-4c1c-a7f5-422dd2215996 / ext4 defaults,discard,data=ordered,defaults 0 1 The final "defaults" may well cancel any preceding option. Actually, "defaults" is really not necessary if any explicit option is given - it is used just as a placeholder. Try "discard,data=ordered" as options. Also check that systemd-remount-root.service was run on boot systemctl status systemd-remount-fs.service
Am 31.05.23 um 10:16 schrieb Andrei Borzenkov:
On Wed, May 31, 2023 at 11:05 AM Daniel Spannbauer <ds@marco.de> wrote:
Am 31.05.23 um 08:30 schrieb Andrei Borzenkov:
No. Show
cat /etc/fstab cat /proc/cmdline findmnt / mkinitrd /etc/fstab: https://paste.opensuse.org/pastes/444091fdc0a5
UUID=d3cf2dfe-2297-4c1c-a7f5-422dd2215996 / ext4 defaults,discard,data=ordered,defaults 0 1
The final "defaults" may well cancel any preceding option. Actually, "defaults" is really not necessary if any explicit option is given - it is used just as a placeholder. Try "discard,data=ordered" as options. Also check that systemd-remount-root.service was run on boot
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
systemctl status systemd-remount-fs.service
It is marked as "active (exited)", juournalctl shows no error. findmt / shows: b-sekret:~ # findmnt / TARGET SOURCE FSTYPE OPTIONS / /dev/sda4 ext4 rw,relatime Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 https://www.marco.de Email ds@marco.de Geschäftsführer Martin Reuter, Torsten Lukas HRB 171775 Amtsgericht München
Daniel Spannbauer composed on 2023-05-31 10:23 (UTC+0200):
Andrei Borzenkov: ...
"defaults" is really not necessary if any explicit option is given - it is used just as a placeholder. Try "discard,data=ordered" as options. Also check that systemd-remount-root.service was run on boot
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
That's because it's a meaningless placeholder used to make an fstab file valid. Something must be in field 4 when otherwise only default options are to be used for that line's mount. If any valid mount option(s) is/are to be included in field 4, defaults in field 4 is nothing but litter. I have hundreds of fstabs here. I doubt any of them, except for backups of original files created by the installer, contain string defaults in field 4. -- Evolution as taught in public schools is, like religion, based on faith, not based on science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata
On 2023-05-31 10:50, Felix Miata wrote:
Daniel Spannbauer composed on 2023-05-31 10:23 (UTC+0200):
Andrei Borzenkov: ...
"defaults" is really not necessary if any explicit option is given - it is used just as a placeholder. Try "discard,data=ordered" as options. Also check that systemd-remount-root.service was run on boot
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
That's because it's a meaningless placeholder used to make an fstab file valid. Something must be in field 4 when otherwise only default options are to be used for that line's mount. If any valid mount option(s) is/are to be included in field 4, defaults in field 4 is nothing but litter. I have hundreds of fstabs here. I doubt any of them, except for backups of original files created by the installer, contain string defaults in field 4.
"defaults" also adds the default options which my contradict, or not, the explicit options. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Carlos E. R. composed on 2023-05-31 11:59 (UTC+0200):
Felix Miata wrote:
Daniel Spannbauer composed on 2023-05-31 10:23 (UTC+0200): ...
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
That's because it's a meaningless placeholder used to make an fstab file valid. Something must be in field 4 when otherwise only default options are to be used for that line's mount. If any valid mount option(s) is/are to be included in field 4, defaults in field 4 is nothing but litter. I have hundreds of fstabs here. I doubt any of them, except for backups of original files created by the installer, contain string defaults in field 4.
"defaults" also adds the default options which my contradict, or not, the explicit options.
I don't find any mention of contradiction in the 15.4 mount man page. String "ontradict" is completely absent. Where do you find it? My reading is that any valid included option overrides any conflicting existing default, thus making inclusion of "defaults" inert litter: # grep s152 fstab LABEL=tm8p11s152 /disks/s152 ext4 noauto 0 0 # mount | grep s152 # mount /disks/s152 # mount | grep s152 /dev/nvme0n1p11 on /disks/s152 type ext4 (rw,relatime) # dmesg | tail -5 [ 7.155973] e1000e 0000:00:1f.6 eth0: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx [ 231.517936] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 231.517959] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 267.462469] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 267.462491] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) # umount /disks/s152 # mount | grep s152 # grep s152 fstab LABEL=tm8p11s152 /disks/s152 ext4 defaults 0 0 # mount /disks/s152 # mount | grep s152 /dev/nvme0n1p11 on /disks/s152 type ext4 (rw,relatime) # dmesg | tail -5 [ 231.517959] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 267.462469] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 267.462491] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 365.845139] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 365.845158] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) # umount /disks/s152 # mount | grep s152 # grep s152 fstab LABEL=tm8p11s152 /disks/s152 ext4 ro 0 0 # mount /disks/s152 # mount | grep s152 /dev/nvme0n1p11 on /disks/s152 type ext4 (ro,relatime) dmesg | tail -5 [ 267.462469] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 267.462491] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 365.845139] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 365.845158] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 434.254734] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. # umount /disks/s152 # mount | grep s152 # grep s152 fstab LABEL=tm8p11s152 /disks/s152 ext4 ro,defaults 0 0 # mount /disks/s152 # mount | grep s152 /dev/nvme0n1p11 on /disks/s152 type ext4 (ro,relatime) # dmesg | tail -5 [ 267.462491] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 365.845139] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 365.845158] ext4 filesystem being mounted at /disks/s152 supports timestamps until 2038 (0x7fffffff) [ 434.254734] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 544.821002] EXT4-fs (nvme0n1p11): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. # rw is a default filesystem-independent mount option. It was not impacted by adding ',defaults' to field 4. -- Evolution as taught in public schools is, like religion, based on faith, not based on science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata
On 2023-05-31 12:50, Felix Miata wrote:
Carlos E. R. composed on 2023-05-31 11:59 (UTC+0200):
Felix Miata wrote:
Daniel Spannbauer composed on 2023-05-31 10:23 (UTC+0200): ...
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
That's because it's a meaningless placeholder used to make an fstab file valid. Something must be in field 4 when otherwise only default options are to be used for that line's mount. If any valid mount option(s) is/are to be included in field 4, defaults in field 4 is nothing but litter. I have hundreds of fstabs here. I doubt any of them, except for backups of original files created by the installer, contain string defaults in field 4.
"defaults" also adds the default options which my contradict, or not, the explicit options.
I don't find any mention of contradiction in the 15.4 mount man page. String "ontradict" is completely absent. Where do you find it? My reading is that any valid included option overrides any conflicting existing default, thus making inclusion of "defaults" inert litter:
I also said "or not" :-) "any valid included option overrides any conflicting existing default" - same as any valid included option overrides any contradicting existing default, ie, contradictions can exist, just that they are resolved. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Carlos E. R. composed on 2023-05-31 13:15 (UTC+02300):
Felix Miata wrote:
Carlos E. R. composed on 2023-05-31 11:59 (UTC+0200):
Felix Miata wrote:
"defaults" also adds the default options which my contradict, or not, the explicit options.
I don't find any mention of contradiction in the 15.4 mount man page. String "ontradict" is completely absent. Where do you find it? My reading is that any valid included option overrides any conflicting existing default, thus making inclusion of "defaults" inert litter:
I also said "or not" :-)
"any valid included option overrides any conflicting existing default" - same as any valid included option overrides any contradicting existing default, ie, contradictions can exist, just that they are resolved.
There's nothing "defaults" can do except make an fstab valid. The defaults are the defaults. They exist at the outset. They can only be accepted, or overridden. Including it can't add any option. Including it can't undo, remove or reverse any option, or resolve any conflict among explicit options and/or defaults. It's an inert placeholder, a dummy. -- Evolution as taught in public schools is, like religion, based on faith, not based on science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata
On 31.05.2023 11:23, Daniel Spannbauer wrote:
Am 31.05.23 um 10:16 schrieb Andrei Borzenkov:
On Wed, May 31, 2023 at 11:05 AM Daniel Spannbauer <ds@marco.de> wrote:
Am 31.05.23 um 08:30 schrieb Andrei Borzenkov:
No. Show
cat /etc/fstab cat /proc/cmdline findmnt / mkinitrd /etc/fstab: https://paste.opensuse.org/pastes/444091fdc0a5
UUID=d3cf2dfe-2297-4c1c-a7f5-422dd2215996 / ext4 defaults,discard,data=ordered,defaults 0 1
The final "defaults" may well cancel any preceding option. Actually, "defaults" is really not necessary if any explicit option is given - it is used just as a placeholder. Try "discard,data=ordered" as options. Also check that systemd-remount-root.service was run on boot
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
systemctl status systemd-remount-fs.service
It is marked as "active (exited)", juournalctl shows no error.
findmt / shows:
b-sekret:~ # findmnt / TARGET SOURCE FSTYPE OPTIONS / /dev/sda4 ext4 rw,relatime
systemd-remount-fs does nothing more than "mount -o remount /". Does it work if you execute it manually?
Doesn't matter if "defaults" is set or not...it seems to have no consequences.
systemctl status systemd-remount-fs.service
It is marked as "active (exited)", juournalctl shows no error.
findmt / shows:
b-sekret:~ # findmnt / TARGET SOURCE FSTYPE OPTIONS / /dev/sda4 ext4 rw,relatime
systemd-remount-fs does nothing more than "mount -o remount /". Does it work if you execute it manually?
It depends on, where you look... dmesg: EXT4-fs (sda4): re-mounted. Opts: discard,data=ordered. Quota mode: none. findmnt /: / /dev/sda4 ext4 rw,relatime -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 https://www.marco.de Email ds@marco.de Geschäftsführer Martin Reuter, Torsten Lukas HRB 171775 Amtsgericht München
On Thu, Jun 1, 2023 at 8:03 AM Daniel Spannbauer <ds@marco.de> wrote: ...
systemd-remount-fs does nothing more than "mount -o remount /". Does it work if you execute it manually?
It depends on, where you look...
dmesg: EXT4-fs (sda4): re-mounted. Opts: discard,data=ordered. Quota mode: none.
findmnt /: / /dev/sda4 ext4 rw,relatime
ext4 only shows in /proc/mounts or moutinfo options that differ from default where default values are set in super block (during creation or by tune2fs). So presumably both options are already set as default. You can check full list of currently used mount options in /proc/fs/ext4/sda4/options
ext4 only shows in /proc/mounts or moutinfo options that differ from default where default values are set in super block (during creation or by tune2fs). So presumably both options are already set as default. You can check full list of currently used mount options in /proc/fs/ext4/sda4/options
Ok, thats a good hint. So I set the journalmode to writeback tune2fs -o journal_data_writeback /dev/sda4 According to you there must be the "data=ordered been shown in the findmnt, cat /proc/mounts and mount. But: b-sekret:~ # findmnt /dev/sda4 TARGET SOURCE FSTYPE OPTIONS / /dev/sda4 ext4 ro,relatime As you can see, it is mounted readOnly. Nothing changed to fstab. The only thing I found in dmesg: EXT4-fs (sda4): Cannot change data mode on remount. It seems that the data-mode cannot be changes via fstab if it is the Root-Device. Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 https://www.marco.de Email ds@marco.de Geschäftsführer Martin Reuter, Torsten Lukas HRB 171775 Amtsgericht München
On Thu, Jun 1, 2023 at 2:48 PM Daniel Spannbauer <ds@marco.de> wrote:
ext4 only shows in /proc/mounts or moutinfo options that differ from default where default values are set in super block (during creation or by tune2fs). So presumably both options are already set as default. You can check full list of currently used mount options in /proc/fs/ext4/sda4/options
Ok, thats a good hint. So I set the journalmode to writeback
tune2fs -o journal_data_writeback /dev/sda4
According to you there must be the "data=ordered been shown in the findmnt, cat /proc/mounts and mount.
But:
b-sekret:~ # findmnt /dev/sda4 TARGET SOURCE FSTYPE OPTIONS / /dev/sda4 ext4 ro,relatime
As you can see, it is mounted readOnly. Nothing changed to fstab.
The only thing I found in dmesg:
EXT4-fs (sda4): Cannot change data mode on remount.
It seems that the data-mode cannot be changes via fstab if it is the Root-Device.
Yes, if the option cannot be changed on remount you need to pass it to initrd. By default dracut is using current options from /proc/self/mountinfo and stores in initrd which is why changing /etc/fstab and running mkinitrd has no effect. Arguably it is not the best default and violates principle of the least surprise You can a) boot using rootflags=... kernel option and then run mkinitrd to store current options in initrd b) run directly "dracut --fstab ..." to regenerate initrd so it (see "man dracut" for full list of options). "dracut --fstab -f" should recreate initrd for the currently running kernel.
Yes, if the option cannot be changed on remount you need to pass it to initrd. By default dracut is using current options from /proc/self/mountinfo and stores in initrd which is why changing /etc/fstab and running mkinitrd has no effect. Arguably it is not the best default and violates principle of the least surprise You can
a) boot using rootflags=... kernel option and then run mkinitrd to store current options in initrd b) run directly "dracut --fstab ..." to regenerate initrd so it (see "man dracut" for full list of options). "dracut --fstab -f" should recreate initrd for the currently running kernel.
Thanks for the explanation. I found an entr in /etc/default/grub with "rootflags=" which seems to cause this confusion :) Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 https://www.marco.de Email ds@marco.de Geschäftsführer Martin Reuter, Torsten Lukas HRB 171775 Amtsgericht München
participants (4)
-
Andrei Borzenkov
-
Carlos E. R.
-
Daniel Spannbauer
-
Felix Miata