html
When examining the partition layout in Fedora 15, many experienced Linux users notice something peculiar - the root filesystem appears to be mounted twice:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 7.9G 596M 6.9G 8% /
/dev/mapper/vg00-lv00 7.9G 596M 6.9G 8% /
rootfs is a special instance of tmpfs that the Linux kernel mounts during early boot. It serves as:
- An initial root filesystem during system initialization
- A temporary holding space before the real root filesystem is mounted
- The foundation for the Linux VFS (Virtual File System)
Here's what happens during system startup:
- The kernel creates an empty rootfs in RAM
- initramfs gets unpacked into rootfs
- The real root device (/dev/mapper/vg00-lv00) is mounted
- rootfs gets pivot_root'ed to the real root
This explains why we see both mount points - the kernel's initial rootfs and the actual root partition.
The magic happens in the kernel's initialization code. Here's a simplified view of the sequence:
start_kernel()
vfs_caches_init()
mnt_init()
init_rootfs() // Registers rootfs filesystem
init_mount_tree() // Creates initial rootfs mount
While this might seem confusing, it has important benefits:
- Early userspace processes can run before disk access is available
- Provides a clean way to transition to the real root filesystem
- Maintains consistency with the Linux VFS architecture
You can examine rootfs details through various methods:
# Check mount information
cat /proc/mounts | grep rootfs
# View kernel messages related to rootfs
dmesg | grep -i rootfs
# Check filesystem type
stat -f -c %T /
This behavior became more visible with:
- The adoption of systemd in Fedora 15
- Changes in the initramfs handling
- Modern kernel versions' approach to early userspace
Advanced users can modify this behavior through kernel parameters:
# To force early rootfs mounting
rootfstype=rootfs
# To debug rootfs initialization
initcall_debug
When examining the partition layout in Fedora 15 (FC15), many experienced users notice something unusual in the df -h
output - the /
directory appears to be mounted twice: once on rootfs
and again on /dev/mapper/vg00-lv00
. This isn't a bug or duplicate mount, but rather a fundamental aspect of Linux's boot process.
rootfs
is a special instance of tmpfs
that the kernel mounts during the early boot stages. It serves as:
- A minimal filesystem for initial boot operations
- A placeholder before the real root filesystem is mounted
- An in-memory structure (similar to other tmpfs mounts)
The sequence of events explains the apparent duplication:
1. Kernel mounts an empty rootfs as part of initialization
2. initramfs gets loaded into this rootfs
3. Device-mapper assembles LVM volumes
4. Real root filesystem (/dev/mapper/vg00-lv00) gets mounted
5. rootfs becomes hidden under the real root
This design has several advantages:
# Checking mount information shows the transition:
$ mount | grep -E '(rootfs|/)'
rootfs on / type rootfs (rw)
/dev/mapper/vg00-lv00 on / type ext4 (rw,relatime,seclabel)
The rootfs
entry remains visible in df
output but is effectively masked by the real root filesystem. All file operations go to the actual disk-based filesystem.
Fedora 15's approach differs from previous versions by:
Feature | Pre-FC15 | FC15+ |
---|---|---|
Initial root | Direct disk mount | rootfs tmpfs |
Visibility | Single root entry | Dual mount points |
Flexibility | Lower | Higher (LVM by default) |
If you encounter problems with this setup, consider:
# Check early boot messages:
$ dmesg | grep -i rootfs
[ 0.000000] RAMDISK: rootfs image found at 0x37000000
[ 1.234567] Trying to unpack rootfs image as initramfs...
Remember that rootfs
is not consuming additional disk space - it's just a temporary in-memory structure that facilitates the boot process before handing over to the persistent root filesystem.