Device drivers and device initialization starts when the kernel goes through the initramfs bridge; the initramfs contains the initial modules needed to set up the devices including the storage device on which the real root filesystem resides.
My question is, does the init
script in initramfs
after loading the relevant modules into the kernel mount the root filesystem on /
in read-only mode ro
?
Unfortunately, I can't read shell scripts, but it seems that fsck
runs from /init
, but I can't say with certainty.
Last but not least, where does the root filesystem get remounted in rw
mode? Possibly in /sbin/init
?
ro
/rw
). If you instructed it to mount in ro mode, fsck on the "real root" is supposed to be performed after switching root and rw remount takes place after that. It is done by whatever handles the fstab as per it. – Tom Yan Aug 24 '17 at 23:19rdinit=
andinit=
for setting the init to run in initramfs root and real root. The fallback value forrdinit=
is/init
, while one of the fallback values forinit=
is/sbin/init
. – Tom Yan Aug 25 '17 at 08:59/init
is usually a shell script in initramfs. I (think) after going through its lines, it mounts real the root filesystem. Basically this chain goes like this:/init --> /sbin/init
where/init
in initramfs and/sbin/init
in the real filesystem. – direprobs Aug 25 '17 at 09:05