On Mon, Nov 17, 2003 at 09:33:59PM +0300, Andrey Borzenkov wrote:Nope. initramfs shares the superblock with 'rootfs', which has the MS_NOUSER flags set. Hence graft_tree() (which is the worker function for MS_BIND) refuses to work.
On Monday 17 November 2003 21:03, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
On Mon, Nov 17, 2003 at 12:50:34PM -0500, Chris Friesen wrote:
viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
On Mon, Nov 17, 2003 at 11:06:48AM -0500, Chris Friesen wrote:
Anyone know why it overmounts rather than pivots?
Because amount of extra code you lose that way takes more memory than
empty roots takes.
Remove whatever files you don't need and be done with that.
How do you remove files from the old rootfs after the new one has been
mounted on top of it?
You do that before ;-)
would the following work?
pivot_root . /initramfs
cd /initramfs && rm -rf *
No. pivot_root() will not move the absolute root of tree elsewhere.
?? doing it before is rather hard ... you apparently still need something to execute your mounts :)
You do, but you can trivially call unlink() on the executable itself. It
will be freed after it does exec() of final /sbin/init...
Alternatively, you could
mkdir /root
mount final root on /root
chdir("/root");
mount("/", "initramfs", NULL, MS_BIND, NULL);
mount(".", "/", NULL, MS_MOVE, NULL);
chroot(".");
execve("/sbin/init", ...)