Add some comments to clarify the mounting of filesystems.

There's no real documenation (which should probably be written!),
so instead document the code the best we can on what's going and
with the mounting of file systems to make future updates easier.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Closes #18000
This commit is contained in:
Turbo Fredriksson 2025-12-04 15:41:02 +00:00 committed by Brian Behlendorf
parent 01cb64510d
commit ead77e952e

View File

@ -334,6 +334,12 @@ load_module_initrd()
}
# Mount a given filesystem
# Note: Filesystem must have either `canmount=on` or `canmount=noauto`.
# This script only deals with "important" file system, such as those
# that are relevant to the operation of the operating system.
# Therefor we need to mount even those that have `canmount=noauto`.
# However, if user have specifically specified `canmount=off`, then
# we will assume that user knows what they're doing and ignore it.
mount_fs()
{
_mount_fs="${1}"
@ -986,6 +992,11 @@ mountroot()
# Go through the complete list (recursively) of all filesystems below
# the real root dataset
# As in, nested filesystems:
# pool/root
# pool/root/usr
# pool/root/var
# [etc]
filesystems="$("${ZFS}" list -oname -tfilesystem -H -r "${ZFS_BOOTFS}")"
OLD_IFS="${IFS}" ; IFS="
"
@ -994,6 +1005,12 @@ mountroot()
IFS="${OLD_IFS}" mount_fs "${fs}"
done
IFS="${OLD_IFS}"
# Mount any extra filesystems specified in `/etc/default/zfs`.
# This should only be datasets *not* located nested below the root
# filesystem, *and* that are part of the operating system.
# I.e., /home isn't part of the OS, it will be mounted automatically
# later in the boot process.
for fs in ${ZFS_INITRD_ADDITIONAL_DATASETS}
do
mount_fs "${fs}"