AutoFsck - Technical Review

Krzysztof Lichota krzysiek at lichota.net
Mon Aug 25 13:09:35 BST 2008


2008/8/22 Phillip Susi <psusi at cfl.rr.com>:
> Krzysztof Lichota wrote:
>>
>> OK, but how to get to rootfs? In my /proc/mounts it is overmounted on
>> "/", so it is not visible. I have tried to mount it in some other
>> directory using "mount -t rootfs none /rootfs" but it fails.
>
> You don't mount rootfs, it isn't an fs type.  It simply is the root
> filesystem that the kernel mounts as the root when it loads the initramfs
> into it, and it is either a tmpfs or a ramfs.

/proc/mounts and /proc/filesystems shows it, so I thought it can be
mounted also. But it has NO_USER flag, so apparently not :(

> No... the last thing the init scripts do is exec run-init, which does the
> chroot+exec, so there is no returning from there.
>
> I had thought that run-init just mounted the target root filesystem in /root
> and then chrooted into it, but now that I check the source, it looks like it
> does a move mount to overlay it on top of /, so given that, it doesn't look
> like there is a way to escape back to it without pivot_root.
>
> So it looks like what you need to do is mount a tmpfs and populate it with
> the binaries ( and other things, like moving /proc, /sys, and /dev there )
> you need, then pivot_root with it and exec the new shell there, which can
> unmount the old root and fsck it.

OK. So basically we are back to pivot_root :)
Thanks for tips :)

-- 

	Krzysztof Lichota



More information about the ubuntu-devel mailing list