kern/149803: [patch] loader: set vfs.mount.rootfrom using label
thomas at FreeBSD.ORG
Fri Aug 20 10:47:41 UTC 2010
* vwe at FreeBSD.org, 2010-08-19 :
> I tend to close this PR but would like to discuss that before.
> A lot of machines I'm responsible for, do not have an /etc/fstab on the boot
> filesystem at all, so loader(8) does not see anything at all.
> If vfs.root.mountfrom is properly set, neither loader(8) nor the kernel
> require any entries to find the root filesystem.
Right, setting vfs.root.mountfrom in loader.conf (or manually at the
loader prompt) is another possibility. The proposed change does not
change anything to the existing behaviour in that case.
> All it takes is the correct filesystem type and device path to the device that
> contains the root filesystem and that all can be set by loader.conf(5).
This assumes that the contents of loader.conf is consistent with the
device name which the kernel will assign to the filesystem. If this
information is known in advance and can be stored in the filesystem, one
might just as well put it in /etc/fstab.
> So in the end, what your PR is all about can be done without any code changes.
I beg to differ. The use case for the proposed change is when you cannot,
or do not want to, hard-code in the filesystem the specific device name
that will be assigned to it.
Think for example of a machine where you want to have a "rescue" slice
that contains an exact copy of the root filesystem taken in some "known
good" state. You want to be able to boot from that rescue slice in case
something goes wrong (e.g. a system upgrade) on the main slice.
With the proposed change, you do not need to remember to fix /etc/fstab
or /boot/loader.conf on the rescue slice at the point where you copy the
"known good" snapshot: you can have the files in the rescue slice have
exactly the same contents as on the main slice.
Then, you can just select the desired slice from the boot blocks prompt,
and with the proposed change the kernel will end up mounting the
corresponding device. If we rely on /etc/fstab or /boot/loader.conf
on the other hand, you will always end up mounting the root fs from the
"main" slice" even if you have read the boot blocks, fstab and
loader.conf from the rescue slice.
Of course, on a machine that has just a single boot slice, my change
does not bring anything compared to setting vfs.root.mountfrom in
loader.conf (but if we follow this line of reasoning, we might just as
well get rid of the existing code in loader that reads /etc/fstab!)
> I'm wondering if you're able to set your root fs to be mounted at boot time, too?
Not sure I understand the question...
More information about the freebsd-bugs