Linux rootfs explanation

223 views

I was trying to understand the term of rootfs, excatly what is it, but I am still not sure about it. Many sources are not clear about it. Is the rootfs:

1. a name of a specific type of filesystem?
2. an alias to the real filesystem, like ext3, ext4 etc., which mounting point is a root folder (‘/’)?
3. just a hierarchical structure, based on FHS?

In: 5

2 Answers

Anonymous 0 Comments

it’s just /, the root directory. it’s got to be mounted from a partition somewhere. that partition is the rootfs. it doesn’t matter if it’s ext4 or xfs or whatever.

it’s important because it’s basically your entire system. the boot stuff is only really important as far as getting your rootfs mounted. you can change how your boot works, change grub or boot directly to the kernel, but it won’t really affect your system.

your /home directory might be part of your rootfs, or you might have a separate partition for it. /var/tmp might be on your rootfs or on its own partition or maybe in ram.

it’s getting fashionable for distributions to have an immutable rootfs. that means that once mounted at boot, nothing can write to it. that’s great for having a secure stable system: malware can’t install itself into your system. it does mean that updates are more complicated, as now the system needs to invent a way that it can remount the system as writable, update it, then make it unwriteable again.

but it’s only your rootfs that’s unwriteable in this case, your home directory will be a different filesystem and be writeable. unless it’s a kiosk device, maybe. since flatpaks usually install into your home directory, this makes flatpaks good for working with distros that have an immutable rootfs. since you can install and update the software the user touches separate to main system.

Anonymous 0 Comments

rootfs is a special instance of a tmpfs, it contains the uncompressed contents of the initramfs. As the name suggests it is mounted at `/` however usually the system will mount another filesystem on top of it after init is started.

[This](https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html) kernel doc has more specific info.