I need to tamper initscripts.

Hello,

I need to perform remotely, a partition layout change on a LIVE platform. That means that I need to make a few changes using a script of mine, to the root directory of the box, after every partition is unmounted apart of the root. Then on the reboot, voila, the new schema would be up and active. So …

I need to know, the exact script, which is responsible for the unmounting of the partitions during the reboot process, so to capture that point, run my own stuff, then leave it to complete it’s reboot circle.

Not sure I understand your approach exactly, but why don’t you login remotely, change to runlevel 1, and unmount the necessary partitions (with your script if necessary), do the necessary repartitioning, then do a simple reboot?

Info on creating and invoking custom init scripts that might be helpful to you:

Cool Solutions: Creating Custom init Scripts

How to run script at startup

Edit: Other members will be able to answer this better than I can.

If you change to runlevel 1 you lose networking. Unless you have something like a remote console facility.

On 2010-10-15 21:36, eNSider wrote:

> I need to know, the exact script, which is responsible for the
> unmounting of the partitions during the reboot process, so to capture
> that point, run my own stuff, then leave it to complete it’s reboot
> circle.

Mounting?

boot.rootfsck
boot.localfs

Umounting? I think the same in reverse.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Thanks for the information. Actually what I need to do, is to modify boot.localfs at certain point … like the example bellow.

UMOUNT_FAILED=false
umount -rv $mtab -t no${tmpfs//,/,no},$nofs -O no_netdev $ulist || {
    rc_status
    UMOUNT_FAILED=true
}
rc_status -v1 -r

#Let's hax0r it
if  -s /.done ]; then
      echo "nothing to do"
    else
      mv /tmp /tmp3
      mv /var /var3
      mv /tmp2 /tmp
      mv /var2 /var
      rm /etc/fstab
      cp /etc/fstab.new /etc/fstab
      echo "fixed" >> /.done
    fi

if test "$UMOUNT_FAILED" = true -a -z "$mtab" ; then

So actually I can manage to fix a wrongly defined partition layout on-line.

Best Regards
Nick.