[arch-general] fstab and root filesystem
Hello, I have been playing with the initramfs, and I noticed that the root filesystem is mounted in read-write mode in early init. Since, by the time /etc/fstab is available, the filesystem on which it resides (presumably, the root filesystem) is already mounted, and mounting it is anyway early init's task, not real init's (because the real init cannot be found without the initramfs), there seems to be no point in keeping it listed. I haven't found anything about this, but commenting out the pertinent line hasn't broken anything. Is it fine, or are there any reasons for it to be listed in fstab? Regards, Kalrish
Hello! Sure, I've seen some distributions do this, go for it! You can supply everything important in fstab through the kernel command line: device => root; type => rootfstype; options => rootflags Mount point, dump and fsck cannot be supplied, but even fsck is provided by systemd-fsck-root.service. Also mind that you can supply rw or ro for the rootfs to be mounted as such, and that ext2/3/4 can store flags within itself, see -o under tune2fs(8). -- Oliver Temlin On Fri, Aug 29, 2014 at 2:04 PM, Kalrish Bäakjen <kalrish.antrax@gmail.com> wrote:
Hello, I have been playing with the initramfs, and I noticed that the root filesystem is mounted in read-write mode in early init. Since, by the time /etc/fstab is available, the filesystem on which it resides (presumably, the root filesystem) is already mounted, and mounting it is anyway early init's task, not real init's (because the real init cannot be found
without
the initramfs), there seems to be no point in keeping it listed. I haven't found anything about this, but commenting out the pertinent line hasn't broken anything. Is it fine, or are there any reasons for it to be listed in fstab?
Regards, Kalrish
Thanks a lot, Temlin! About root fsck, I guess it should be run from the initramfs...? AFAIK, rw-mounted filesystems must not be checked. I'm also looking at using systemd inside the initramfs, where, I think, systemd-fsck-root.service fits - was that what you meant? It seems dracut already does this, and I recall seeing a 'systemd' hook being added to mkinitcpio, before my laptop died - I don't know what's the current status on that, though. If systemd, along with its udev implementation, were used, there would be no need to fill up the kernel command line, plus all those parameters would be permanently stored in the cpio archive. I'll continue on the matter. Thanks again, Kalrish On Fri, Aug 29, 2014 at 3:02 PM, Temlin Olivér <temlin@gmail.com> wrote:
Hello!
Sure, I've seen some distributions do this, go for it! You can supply everything important in fstab through the kernel command line: device => root; type => rootfstype; options => rootflags Mount point, dump and fsck cannot be supplied, but even fsck is provided by systemd-fsck-root.service. Also mind that you can supply rw or ro for the rootfs to be mounted as such, and that ext2/3/4 can store flags within itself, see -o under tune2fs(8).
-- Oliver Temlin
On Fri, Aug 29, 2014 at 2:04 PM, Kalrish Bäakjen <kalrish.antrax@gmail.com> wrote:
Hello, I have been playing with the initramfs, and I noticed that the root filesystem is mounted in read-write mode in early init. Since, by the
time
/etc/fstab is available, the filesystem on which it resides (presumably, the root filesystem) is already mounted, and mounting it is anyway early init's task, not real init's (because the real init cannot be found without the initramfs), there seems to be no point in keeping it listed. I haven't found anything about this, but commenting out the pertinent line hasn't broken anything. Is it fine, or are there any reasons for it to be listed in fstab?
Regards, Kalrish
Thanks a lot, Temlin! About root fsck, I guess it should be run from the initramfs...? AFAIK, rw-mounted filesystems must not be checked.
That's exactly what happens, see the service file: "ConditionPathIsReadWrite=!/" So you proabably have to add the ro option (if that's not the default), because systemd will remount r/w: systemd-fsck-root.service is before local-fs.target which wants systemd-remount-fs.service, but the man page for the latter mentions that it only runs entries that exist under fstab. I suggest you try it without an entry in fstab, both with ro and rw and report your findings to the fstab page on the wiki. -- Oliver Temlin
participants (2)
-
Kalrish Bäakjen
-
Temlin Olivér