OS Restore notes

From CobaltFAQs

Jump to: navigation, search

These are some notes on how the OS Restore process works. This might be of use to someone trying to build or modify a server-based restore system, etc.

Cobalt appliances have a Linux kernel in PROM that supports NFS. They load this kernel, then use nfsroot to mount the root filesystem from an NFS server. nfsroot is a standard Linux kernel capability, documented in /usr/src/linux/Documentation.

By default, nfsroot uses bootp to get an IP address. Also by default, it uses the bootp server as the NFS server. So the Cobalt appliance wakes up, loads a kernel from PROM, does a bootp, gets networking parameters, and mounts a directory exported as nfsroot to be its root directory. Once nfsroot is mounted, it uses the standard Red Hat initialization scripts (control is passed to /sbin/init). All the scripts being executed are this in the cobalt/nfsroot-x86 directory on the OSRCD. This is where the hardwired use of the "tester" NFS server and IP occur.

/sbin/init executes rc.sysinit

rc.sysinit sets the path, hostname, mounts /proc, configures the loopback interface, starts portmap, starts swap, then runs /usr/local/sbin/mount_testdir.pl

mount_testdir.pl mounts tester:/test_dir as /test and gets the ROM version

By editing nfsroot-x86/etc/resolv.conf and changing the mount_testdir.pl, you can get the RaQ to use another server (and not the CD) as its DNS and NFS server.

At this point, you have the exported nfsroot-x86 mounted as the RaQ's root directory, and a new mount /test, which is an NFS mount of test_dir on the NFS server.

rc.sysinit then runs /test/main_script

/test/main_script just sets the script directory to /test/scripts, then calls /test/scripts/os_restore_build

os_restore_build runs ifuncs, which mostly defines a bunch of Perl subroutines for use by other scripts. Most of them are related to the Cobalt database. os_restore_build then finds the build version in /nfsroot/bto-sync, and compares it to the ROM version on the appliance for compatibility. It also checks that there is a legal release spec for the build.

If things are OK, it then calls the nfsroot-x86/bto-sync/production/nnnnR_x.xxx/installer/build_release script.

build_release uses the spec file (also in the installer direvtory). it then calls cobalt_install which does the disk partitioning and RPM installation.

When build_release returns, os_restore_build uses ifuncs/superhack to clean up the networking configuration. It also writes a script called mfg_hook into the rc3.d directory as S98zzzDELETE_MEzzz. This script will be run after reboot for all post-install cleanup scripts, and clean up and erase stuff.

After all this, control is returned to rc.sysinit, which reboots the RaQ.

On reboot, the mfg_hook script runs and the system is ready to use.

Personal tools