AutoFsck - Technical Review

Krzysztof Lichota krzysiek at
Wed Aug 20 14:20:57 BST 2008

2008/8/19 Phillip Susi <psusi at>:
> Krzysztof Lichota wrote:
>> I have hit the same problem. I wanted to unmount the root partition
>> (by doing pivot_root trickery), but I couldn't make it work. If
>> someone knows how to do it, I would be very interested in the
>> solution.
> I believe that pivot_root is considered depreciated.  IIRC, the new method
> being used in the initramfs is to mount the real root in /root, unlink all
> other files in /, then chroot into /root and exec init.
> That means you should be able to escape the chroot back to the real rootfs (
> using the chroot to subdir without cwd there trick ), repopulate it with
> copies of all the files you will need to run the check, kill off all other
> running processes, then exec another binary you just placed in the rootfs
> which will umount /root, run the fsck, and  shutdown.

I don't quite follow you :) Can you be more explicit or give link to
example code?

In particular, what do you mean by "unlink all other files in /"?
Unlink in the sense of "rm"?

And the process you described is good for switching root to
subdirectory. AFAIK this leaves old rootfs mounted. But how to apply
it to switch from disk root to some other root _with unmounting
previous root_?


	Krzysztof Lichota

More information about the ubuntu-devel mailing list