switch_root usage

James Bowlin bitjam at gmail.com
Sun Jun 24 16:54:43 UTC 2018


On Sun, Jun 24, 2018 at 12:20 PM, MikeB said:
>  So, I created a block-based root disk and started using
>  switch_root early in boot.  So far, so good.
>
> However, I see almost no difference in memory usage after the
> switch_root (looking at slabtop and /proc/meminfo).

I drop caches right before I switch_root with this line:

    echo 3 > /proc/sys/vm/drop_caches

You could see if that helps.

> Am I correct in unmounting/switch_root/re-mounting for these
> filesystems?

I mount them all again under the new root directory before I
switch_root.  I imagine mounting them after switch_root would
work too.  Doing it before allows me to chroot before I
switch_root.  I only bother with umounting /dev/pts/.  I would
be surprised if switch_root moved or remounted the pseudo
filesystems for you automatically.


Peace, James


More information about the busybox mailing list