diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-01-14 13:22:54 +0300 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-01-14 13:23:39 +0300 |
| commit | 313c47f4fe4d07eb2969f429a66ad331fe2b3b6f (patch) | |
| tree | ca0c488cde000bca75e0b8a60647d2fd8b5601f2 /Documentation | |
| parent | 7416634fd6f18762edf60ed8524bc241eceae1f3 (diff) | |
| download | linux-313c47f4fe4d07eb2969f429a66ad331fe2b3b6f.tar.xz | |
fs: use nullfs unconditionally as the real rootfs
Remove the "nullfs_rootfs" boot parameter and simply always use nullfs.
The mutable rootfs will be mounted on top of it. Systems that don't use
pivot_root() to pivot away from the real rootfs will have an additional
mount stick around but that shouldn't be a problem at all. If it is
we'll rever this commit.
This also simplifies the boot process and removes the need for the
traditional switch_root workarounds.
Suggested-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/filesystems/ramfs-rootfs-initramfs.rst | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.rst b/Documentation/filesystems/ramfs-rootfs-initramfs.rst index a8899f849e90..165117a721ce 100644 --- a/Documentation/filesystems/ramfs-rootfs-initramfs.rst +++ b/Documentation/filesystems/ramfs-rootfs-initramfs.rst @@ -76,13 +76,8 @@ What is rootfs? --------------- Rootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is -always present in 2.6 systems. Traditionally, you can't unmount rootfs for -approximately the same reason you can't kill the init process; rather than -having special code to check for and handle an empty list, it's smaller and -simpler for the kernel to just make sure certain lists can't become empty. - -However, if the kernel is booted with "nullfs_rootfs", an immutable empty -filesystem called nullfs is used as the true root, with the mutable rootfs +always present in Linux systems. The kernel uses an immutable empty filesystem +called nullfs as the true root of the VFS hierarchy, with the mutable rootfs (tmpfs/ramfs) mounted on top of it. This allows pivot_root() and unmounting of the initramfs to work normally. @@ -126,25 +121,14 @@ All this differs from the old initrd in several ways: program. See the switch_root utility, below.) - When switching another root device, initrd would pivot_root and then - umount the ramdisk. Traditionally, initramfs is rootfs: you can neither - pivot_root rootfs, nor unmount it. Instead delete everything out of - rootfs to free up the space (find -xdev / -exec rm '{}' ';'), overmount - rootfs with the new root (cd /newmount; mount --move . /; chroot .), - attach stdin/stdout/stderr to the new /dev/console, and exec the new init. - - Since this is a remarkably persnickety process (and involves deleting - commands before you can run them), the klibc package introduced a helper - program (utils/run_init.c) to do all this for you. Most other packages - (such as busybox) have named this command "switch_root". - - However, if the kernel is booted with "nullfs_rootfs", pivot_root() works + umount the ramdisk. With nullfs as the true root, pivot_root() works normally from the initramfs. Userspace can simply do:: chdir(new_root); pivot_root(".", "."); umount2(".", MNT_DETACH); - This is the preferred method when nullfs_rootfs is enabled. + This is the preferred method for switching root filesystems. Populating initramfs: --------------------- |
