Technical article 104767

Recover OpenServer 5 root filesystem after crash if backups, boot/root exist.

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

I need a quick recovery method to recover from a system crash in which the root file system is unmountable.

Solution

The solution is divided into three parts.

The first section, Preparation, describes the steps to take before a crash.

The second section, Recovery, describes the steps to take if you are already in a crash situation and need to recover.

The third section, Replacing the Boot Sectors describes an extra step to take if the root drive was destructively scanned during recovery.

The fourth section is a Alternate Restore procedure should the backup of root and boot filesystem have been made to a single tape.

+----------------------------------------------------------------------+
I. Preparation
1. Immediately following installation of your operating system,
   configure the tape device with which you intend to do your full
   system backup and recovery.  Test the tape drive and verify the
   names you use for the tape devices. (xct0 and rct0 are common and
   will be used in all examples.  Be sure to substitute your actual
   device names.)
2. Run "mkdev fd" and create one root and one boot floppy disk.
   You may create either the system specific or generic boot
   floppy.  Be sure to label the system specific boot floppy
   carefully, as it can only be used to boot the machine
   it was made on.

These images can be read back onto another server using 'dd'.

3. Verify that the devices used to do your backups are identical on the root floppy disk and the root hard drive.

To do this:

a. Use the l command to list your tape devices:

# l /dev/rct0 /dev/xct0

Your output should look something like the example below.

The important information to gather from the listings are
the major and minor numbers of the tape devices.  In this
example, /dev/rct0 has major 46 and minor 0, and /dev/xct0
has major 46 and minor 128.
# l /dev/rct0 /dev/xct0
crw-rw-rw-   1 root    other    46,  0 May 23 1995 /dev/rct0
crw-r--r--   1 root    other    46,128 May 23 1995 /dev/xct0
                                ^^,^^^
                             major, minor

b. Compare these values with the values on your root floppy.

Because the root filesystem on the SCO OpenServer root floppy is contained in a compressed ramdisk, you must shut down the system and boot off the boot/root set in order to check the device nodes. To do this:

(1) Shut down the system with the shutdown command:

# shutdown -g0 -y

(2) At the safe to power off message, insert the boot floppy in the drive, and press <Enter>.

(3) Insert the root floppy when prompted.

(4) After the system loads and displays the # prompt, list the tape device nodes as in step 3a above.

# l /dev/rct0 /dev/xct0

Compare the major and minor numbers from the listing obtained in 3a with the output on the screen.

If the major and minor numbers are the same, proceed to step 5.

Here is an example where the root floppy major and minor
values do not match.  The example includes the steps to
take to correct the discrepancy.
# l /dev/rct0 /dev/xct0
crw-rw-rw-   1 root    other    10,  0 May 23 1995 /dev/rct0
crw-r--r--   1 root    other    10,128 May 23 1995 /dev/xct0
# rm /dev/rct0 /dev/xct0
# mknod /dev/rct0  c <rct0 major> <rct0 minor>
# mknod /dev/xct0  c <xct0 major> <xct0 minor>

Where <rct0 major>, <rct0 minor>, <xct0 major>, and <xct0 minor> are the values from the device nodes on the hard drive. (refer to the output captured in step 3a)

(5) Enter the command /etc/haltsys to halt the system.

At the 'Safe to power off...' prompt, remove the root floppy from the drive and press any key to reboot.

4. Run divvy(ADM) with the -P and -N options and write down the type of filesystem and the beginning and ending locations of each divvy division.

The syntax and output of this divvy command are:

# divvy -P -N
0              0          14999   boot     EAFS
1          15000          39574   swap     NON FS
2          39575         346775   root     HTFS
3         346776        1022965   u        HTFS
6        1022966        1022975   recover  NON FS
7              0        1023983   hd0a     WHOLE DISK

5. If you have other fdisk divisions, run fdisk -p and write down the beginning and ending locations of each fdisk partition.

Be sure to note which partition is currently active.

The syntax and output of this fdisk command are:

# fdisk -p
1 1 63999 63999 UNIX Active

6. Make separate relative cpio backups of all file systems on the root drive.

If this was a fresh install, you will have at least a /stand
and / (root) filesystem to back up.  You may also have a /u
filesystem as well (refer to the divvy -P -N output captured
above).
If this was an in-place upgrade from an earlier SCO release,
there will be no /stand filesystem.  A /u filesystem may still
exist.

Use the scoadmin Backup Manager to create unscheduled backups of all of the filesystems on the root drive -- this is a preferred method of performing the backups as it will identify all of the filesystems you need to back up, as well as allowing you to archive defaults for blocking factor (cpio's -C option), volume size (-K option), and tape device.

You may also run backups from the command line as in earlier releases.

For example, as described in TA 116586

To do this, place a usable tape in the tape drive and issue the following commands while logged in as root:

/stand (Fresh install only):
===========================
# cd /stand
# find . -print | cpio -ocv -O <tape backup device>
/ (root) (Fresh and Upgrade Installs):
======================================
# cd /
# find . -mount -print | \
cpio -ocv -C 10240 -K <tape size> -O <tape backup device>

Where: <tape size> is the size of the tape volume in kilobytes (a 525 megabyte tape would be specified as 524000)

<tape backup device> is your usual backup device as determined above

(This command has been 'folded' at the "\". It is not necessary to type the "\" when actually running the command.)

/u (or equivalent) (Fresh and Upgrade installs):
===============================================
# cd /u
# find . -print | \
cpio -ocv -C 10240 -K <tape size> -O <tape backup device>
+----------------------------------------------------------------------+
II. Recovery

Once a crash occurs from which you cannot recover:

1. Boot your computer from the emergency boot floppy.

2. At the Boot: prompt, press <Enter>.

3. Insert the root floppy when requested and press <Enter>.

4. At the # prompt, run the command mkdev hd.  This command
   will allow you to initialize your root hard drive as if you
   were installing for the first time.

fdisk(ADM) will be run and you may partition the drive as captured in section I, step 5. If only the root file system is corrupted, it is not necessary to repartition the drive. If you do not need to repartition, type 'q' to quit fdisk.

badtrk(ADM) will be run next.  You may choose quick or thorough
and destructive or non-destructive scans.  Note that if you
destructively scan the disk, you will overwrite the boot sectors
of the drive.  See section III, Replacing the Boot Sectors.

If you do not scan the drive, do not change the default size of the badtrack table -- this will destroy all of the remaining filesystem divisions on the drive.

divvy(ADM) will be called to allow you to sub-divide the active
partition into filesystem divisions.

You will be prompted to supply sizes for the /stand and / filesystems, specify a swap space allocation, and asked if you wish to create a /u filesystem.

You should give sizes that match the output from the divvy -P -N command run during section I, Preparation. If you want to change the sizes, make sure you create divisions that are at least as large as before.

If a valid division table exists on the hard drive, you will be given the option of preserving non-root filesystems.

5. After installing the division table, restore the filesystems. Either perform steps 5a), if the system was originally fresh installed, or steps 5b), if the system was originally an (in-place) upgrade install.

Please Note: If secondary filesystem(s) were mounted and were
backed up along with the root filesystem, you should include
a pattern to the cpio restore command to exclude (defer)
restoring of the secondary filesystem.  (The /u filesystem
could be later restored in system maintenance mode--at that
time use the cpio pattern 'u/*'.)  For example, say that the
/dev/u filesystem was mounted to /u when the cpio relative
pathname backup was done.  To exclude restoring the /u data
from a "root" backup, the cpio line would be:
# cpio -iBudvcm -I <backup_tape_device> '!u/*'
5a. Fresh Install
=================
Please Note:  The following assumes that the /dev/root and the
/dev/boot filesystems are on separate tapes.  If this is
not the case, please see section IV) Alternate Restore.
put cpio tape of /stand filesystem in drive
# mount /dev/boot /mnt
# cd /mnt
# cpio -iBudvcm -I <backup_tape_device> (usually /dev/rct0)
# cd /
# umount /mnt

put cpio tape of root filesystem in the drive

# mount /dev/hd0root /mnt
# cd /mnt
# cpio -iBudvcm -I <backup_tape_device> (usually /dev/rct0)
# mkdir stand
# cd /
# umount /mnt
# /etc/haltsys

Press any key to reboot and restore /u filesystem, if necessary, from normal boot.

5b. Upgrade Install
===================

put cpio tape of root filesystem in the drive

# mount /dev/boot /mnt
# cd /mnt
# cpio -iBudvcm -I <backup_tape_device> (usually /dev/rct0)
# cd /
# umount /mnt
# /etc/haltsys

Press any key to reboot and restore /u filesystem, if necessary, from normal boot.

+----------------------------------------------------------------------+
III. Replacing the Boot Sectors
If you destructively scan the drive in section II, step 4, you
may get the error 'NO OS' after the first reboot.  If this is
the case:

1. Power off the machine, and reboot with the emergency boot floppy in the floppy drive.

2. Press <Enter> at the Boot: prompt and insert the root floppy when prompted.

3. At the '#' prompt replace masterboot by typing the command:

# /bin/dparam -w

4. Replace hdboot0 and hdboot1 with these commands:

# /bin/dd if=/etc/hdboot0 of=/dev/hd0a
# /bin/dd if=/etc/hdboot1 of=/dev/hd0a bs=1k seek=1

Please Note: If the above procedures are not successful, reinstall the operating system using "restart" at the boot: prompt. Once you can boot off your hard disk, enter single user mode and restore from your cpio backup of the root filesystem.

+----------------------------------------------------------------------+
IV. Alternate Restore (More Common)

This section is an alternative to the restore procedure for the case that the the backup of /dev/root and /dev/boot were combined on one tape using a command similar to:

find / -print | cpio -ocvB > /dev/tapedev (do not type in!)

Put cpio tape of root and boot filesystems in drive

# mount /dev/hd0root /mnt
# mkdir /mnt/stand
# mount /dev/boot /mnt/stand
# cd /mnt
# cpio -iABudvcm -I<backup_tape_device>
# cd /
# umount /mnt/stand
# umount /mnt
# /etc/haltsys

Please Note: the <backup_tape_device> is usually /dev/rct0.

Press any key to reboot and restore /u filesystem, if necessary, from normal boot.

NOTE:     If you do not have your Emergency Recovery Disks to boot from then
          it is possible to install the operating system on a new disk using
          either your correct licensing or the Evaluation License supplied in
          the media kit.
Create your additional filesystems as appropriate.

Once installed, boot into Single-User Mode and restore from the tape using the process above.

This procedure assumes that the BTLD drivers for the hardware controllers will be the same.

The size of the disk may also vary although it is not recommended to use a smaller disk in case the root disk space is exceeded.

NOTE:     If you fail to mount /dev/boot under /mnt/stand when you restore
          your data the contents of /stand will reside not in the EAFS /stand
          filesystem but in the HTFS /root filesystem which will result in the
          Master Boot Record not being able to access /stand/boot and you will
          get the error message:
"Stage1 boot failure: error loading hd(40)/boot"

See also

TA125056, "Get "Stage1 boot failure: error loading hd(40)/boot" after installation of SCO Openserver 5.0.7."

TA112505, "Additional Notes on Emergency Recovery for SCO OpenServer 5.0.6."

From the Xinuos technical article database, record 104767. Reproduced with permission. The original is at www.sco.com/ta/104767, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.