[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pivot_root. unmount old root



You would probably want to run all the executable files in /etc/rc6.d
in alphabetical order, supplying the "stop" parameter, with the
exception of the last one, which on my system is S90reboot.

that's what I was doing - only with runlevel 0 without doing the actual halt at the end.

Then run something like this:

----------

#!/bin/sh
# Example: mount the new root file system over NFS from 10.0.0.1:/my_root
# and run init.
ifconfig lo 127.0.0.1 up   # for portmap
# configure Ethernet or such
portmap  # for lockd (implicitly started by mount)
mount -o ro 10.0.0.1:/my_root /mnt
killall portmap   # portmap keeps old root busy
cd /mnt
pivot_root . old_root
exec chroot . sh -c 'umount /old_root; exec /sbin/init \
  <dev/console>dev/console 2>&1

----------

I only see 2 places (without patching init itself) to put these commands:
1. into a new shutdown script in place of S90{halt,reboot}
2. into the rc script

But no matter which of these I choose there remains at least init and perhaps the process executing rc running and keeping the old root busy. So I cannot unmount it. At least on my system init has opened some shared libraries in old-root/lib/... and rc as well (if it is still running)

The same would happen if I restarted init with telinit -u runlevel...

Your script above is from the manpage of pivot_root, isn't it? I really wonder in which context this example (and also the other one given in the manpage) could work? Have you sucessfully tried it on your system?

K. Haselhorst


Reply to: