Chapter 6 Creating and using emergency recovery media Emergency recovery media (diskettes and tapes) enable you to recover your system if your hard disk experiences an unrecoverable error. You should create emergency recovery media immediately after you install your system, and again each time you add or change system hardware and software. The following topics describe: + an overview of recovering your system + creating emergency recovery diskettes and tapes + recovering your system using emergency recovery media Keys to recovering your system To ensure that you always have a set of emergency recovery media and data backups, we strongly recommend that you: + Create emergency recovery diskettes and tapes immediately after installing and configuring your system. If you install additional system or application software at a later time, create new emergency recovery disks and tapes. + Back up your system on a regular basis (daily or weekly). The length between backups is correlated to the amount of possible data loss. If you back up your system each day, you can only lose up to one day's data. If you only back up your system once a month, up to one month's worth of data might be lost if your hardware fails. The emergency recovery diskettes contain a small, bootable version of UnixWare 7 from which you can boot your system. The emergency recovery tapes contain an image of critical UnixWare 7 filesystems. If you have the UnixWare 7 NetWare Services product installed and configured, the tapes also contain an image of the NetWare Directory Services (NDS) master partitions and NetWare SYS: volume defined on your system. By first booting your system with the emergency diskettes and then restoring it from the emergency tapes, you restore all the system software, filesystems, and NDS partitions that existed when you created the diskettes and tapes. _________________________________________________________________________ NOTE If your system does not have a tape drive, you should still create emergency recovery disks and then back up the entire system onto other media or across the network by using SCO ARCserve(r)/Open from Cheyenne(r) or the cpio command. See SCO ARCserve/Open from Cheyenne in SCOhelp and the cpio(1) manual page for more information. _________________________________________________________________________ Performing regular system backups ensures that data added to your system after the creation of the emergency recovery media can also be restored. Data created after the most recent backup may be lost if your hard disk fails. The system owner can back up the entire system on a regular basis. Individual users without owner privileges can perform backups of their own directories. To ensure that you back up not only data but also any extended file attributes (such as privileges, ACLs, and NetWare file attributes), use SCO ARCserve/Open from Cheyenne or cpio(1). See SCO ARCserve/Open from Cheyenne in SCOhelp and the cpio(1) manual page for more information. Creating emergency recovery diskettes To create emergency recovery disks: 1. Use the format(1M) command to create two formatted diskettes. For example, this command creates a formatted, 1.44MB diskette in the primary diskette drive: format -v /dev/rdsk/f03ht 2. Label the diskettes with the name of the system, date created, and their name and number. For example: mymachine mymachine 30 January 1998 30 January 1998 Emergency Recovery Emergency Recovery Diskette 1 Diskette 2 _______________________________________________________________________ NOTE Emergency recovery disks are customized for a particular system and only work on that system. _______________________________________________________________________ 3. Log in to the system console as root. To switch from the graphical environment, press . 4. Make sure there are no active users on the system. Enter: who 5. If root is the only user logged in, bring the system to single-user mode with this command: shutdown -y -g0 -i1 If other users are listed, bring the system to single-user mode with this command: shutdown -y -g300 -i1 The -g300 flag in this command allows users 5 minutes (300 seconds) to close their files and log out. A broadcast message from root provides warnings that the system is coming down. 6. After the system enters single-user mode, determine in which filesystem you will create the recovery media. The filesystem must contain at least 30MB of free space. To determine which filesystems have enough space, enter: /sbin/dfspace For example, you might see: / : Disk space: 195.10 MB of 429.00 MB available (45.48%) /stand : Disk space: 5.82 MB of 9.99 MB available (58.28%) /home : Disk space: 238.86 MB of 479.00 MB available (49.87%) /tmp : Disk space: 7.98 MB of 8.00 MB available (99.85%) /var/tmp : Disk space: 9.99 MB of 8.99 MB available (90.00%) In this example, only the root (/) and /home filesystems have enough space to be used for creating the emergency recovery media. 7. Enter: /sbin/emergency_disk -d pathname diskette pathname is the filesystem you selected. diskette is the diskette drive where you will insert the diskette (either diskette1 or diskette2). The following example creates an emergency recovery diskette on the first diskette drive, using the /home filesystem as its working directory: /sbin/emergency_disk -d /home diskette1 8. When prompted, insert the first formatted disk into the appropriate diskette drive. Creating each emergency recovery disk takes about fifteen minutes. 9. When prompted, remove the first diskette, insert the second diskette and press . 10. When prompted, remove the diskette from the diskette drive. Store the emergency recovery disks in a secure location. After you create the emergency recovery diskettes, do one of the following: + If your system has a tape drive, you should now create emergency recovery tapes. + If your system does not have a tape drive, then you should now create a full system backup onto the network or other media. Creating emergency recovery tapes Emergency recovery tapes allow you to restore your system and its data to the configuration stored on the media. _________________________________________________________________________ NOTE If you have installed the NetWare Services package, you may need to run the Directory Services Install utility before beginning this procedure. If you are creating emergency recovery media immediately after installing your system, you do not need to run this utility. If, however, you add NDS partitions and NetWare volumes after installation, you must run Directory Services Install so that these partitions and data can be backed up. For more information, see ``Installing NetWare Directory Services'' in SCOhelp. _________________________________________________________________________ To create emergency recovery tapes: 1. Locate and label tapes for this procedure. Include the system name, date the tapes were created, and sequence number. The number of tapes needed varies according to the size and configuration of your system. 2. Log in to the system console as root. To switch from the graphical environment, press . 3. If the system is already in single-user mode, skip to step 5. Otherwise, make sure there are no active users on the system. Enter: who 4. If root is the only user logged in, bring the system to single-user mode with this command: shutdown -y -g0 -i1 If other users are listed, bring the system to single-user mode with this command: shutdown -y -g300 -i1 The -g300 flag in this command allows users 5 minutes (300 seconds) to close their files and log out. A broadcast message from root provides warnings that the system is coming down. 5. At the single-user prompt (#), insert the first emergency recovery tape into the appropriate cartridge tape drive. 6. Create the emergency recovery tapes using either step a or step b. a. Use this step only if all the conditions below are true: + you have only one hard disk installed on your system + the tape drive you are using has the capacity to back up your entire hard disk on one tape + (if you have the UnixWare 7 NetWare Services product installed) the NetWare server on your system is the only server on the network Enter: /sbin/emergency_rec -e tape tape is the tape drive location of your inserted tape (ctape1 or ctape2). The -e option tells emergency_rec to back up the entire primary hard disk. Wait for this command to finish processing and then go to Step 7. b. Use this step for a multiple hard disk system or a single disk system that does not meet the conditions in Step 6a. Enter: /sbin/emergency_rec tape tape is the tape drive location of your inserted tape (ctape1 or ctape2). The emergency_rec command (without the -e option) backs up: + all UnixWare 7 partitions on your primary hard disk + the /home, /home2, /var, and /usr filesystems from the secondary hard disk, if they exist there + the SYS: volume of the NetWare Server, if NetWare Services is installed + any master NDS partitions defined on your system, if NetWare Directory Services is installed _______________________________________________________________ NOTE The emergency_rec command does not back up any other UnixWare 7 filesystems on the secondary disk, nor any filesystem on additional hard disks, nor any additional NetWare server volumes defined on any disk. To back up these filesystems and volumes, see ``After creating emergency recovery tapes''. _______________________________________________________________ You are prompted to insert additional tapes as needed. 7. Remove the last tape from the tape drive. 8. Store the emergency recovery tapes with the emergency recovery floppy disks in a secure location. Handling tape error messages The following error messages may appear when you create emergency recovery tapes: + Cannot determine mountpoint for device This message appears when a slice cannot be associated with a filesystem. This prevents the indicated slice from being backed up or restored. + Duplicate mountpoint detected with device This message appears when the determination of what filesystems the slices are associated with produces a duplicate. Common causes of this error include using old style device names (dev/dsk/1s1 instead of /dev/dsk/c0b0t1d0s1), or having entries commented out in /etc/vfstab. If you encounter this message, you must fix the problem before making the emergency recovery tape. After creating emergency recovery tapes After you create the emergency recovery tapes, either: + Begin regularly scheduled backups of your system as soon as you begin using it, if you used Step 6a of ``Creating emergency recovery tapes''. + Separately back up any data that was not copied onto the emergency recovery tapes, if you used Step 6b of ``Creating emergency recovery tapes''. Specifically, you need to back up: - any UnixWare 7 filesystems not on the primary hard disk - the /home, /home2, and /usr filesystems, if they are defined on a disk other than the primary or secondary hard disk - any NetWare volumes other than SYS: (including any defined on the primary hard disk) The easiest way to do this is to make a full system backup. Then, you can begin a regular schedule of incremental backups. You must use the cpio(1) command to perform these backups if you want to retain privilege and NetWare-related data on the files you back up. Recovering an unusable system If your system will not boot, your system software is corrupted beyond repair, or your hard disk has been reformatted or replaced, you can use your emergency recovery media and incremental backups to restore your system. Before attempting to restore the system, ensure that your motherboard, hard disks, memory, and peripherals are in good working order. Do so by running any hardware diagnostics included with your system by the manufacturer. While this recovery procedure restores all the system software, applications, and data on the recovery media to your hard disk, it does not ensure proper operation of the system hardware. To recover the system: 1. Place the first emergency recovery diskette in the primary (boot) diskette drive, and reboot your system. + If you mistakenly inserted the wrong disk, replace the current disk with the correct emergency disk and repeat this procedure. + If you want to use this disk, enter the license number from the Certificate of License and Authenticity for your system. 2. Correct the system damage or restore data from the emergency recovery tapes. The emergency recovery main menu provides options to: + start a limited UnixWare 7 operating system command-line shell + restore data from emergency recovery tapes + mount or unmount all filesystems (if UnixWare 7 data is accessible on the hard disk) + reboot the system 3. Use the up or down arrow keys or the key to select the desired choice and then press . + If you select to invoke an emergency shell, a shell prompt is displayed and the following commands are available: cat(1) chroot(1M) cpio(1) date(1) dd(1M) echo(1) edvtoc(1M) fdisk(1M) find(1) fsck(1M) grep(1) ksh(1) labelit(1M) ln(1) ls(1) mkdir(1) mkfs(1) mount(1M) prtvtoc(1M) rm(1) stty(1) vi(1) Use these commands to investigate and fix the problem. To exit the shell and return to the main menu, press . ____________________________________________________________________ NOTE Some of these commands (for example, the find command) are limited-function shell aliases for the regular UnixWare 7 commands. If the hard disk is functional and mounted, you can execute the full-function commands from the hard disk by specifying the full path of the command (for example, /mnt/usr/bin/find). ____________________________________________________________________ + If you select to reinstall your system, insert the emergency recovery tapes when prompted. Wait for the processing of the last tape to complete before going to the next step. + If you select to mount filesystems, the UnixWare 7 filesystems are mounted. If you then invoke the emergency shell, you can access all the UnixWare 7 commands on your system. If your hard disk is severely damaged, this option may not be available. + If you select to unmount filesystems, the UnixWare 7 filesystems are unmounted. If your hard disk is severely damaged, this option may not be available. + You can choose to reboot your system. If you used the emergency recovery shell to repair your system, remove the second emergency recovery disk from the disk drive before selecting the option to reboot your system. 4. Remove the emergency recovery disk. If you restored the system from the emergency recovery tapes, you can remove the last tape from the tape drive at this time. 5. Press to reboot your system. You may notice error messages similar to the following: UX: initprivs: WARNING: File ``file'' fails validation: entry ignored UX: initprivs: WARNING: X entries ignored in ``/etc/security/tcb/privs'' This is because the date stamp for the inode was changed during the restore process. You can fix these errors after your system boots into multi-user mode, by logging in as root and entering the following command: /etc/security/tools/setpriv -x 6. If your system has the Netware Services (nws) package installed, you are prompted to re-insert the recovery tape after the system reboots, to complete the restoration of the NetWare file attributes. 7. If you are running NetWare Directory Services on your system as part of the UnixWare 7 NetWare Services product, there are additional steps you need to follow to restore NDS if your system is part of a multiple-server NDS tree. These steps are necessary to avoid creating problems on the other servers on your network. For full information regarding restoring NDS for the UnixWare 7 NetWare Services product, see the Installation Handbook for that product. 8. If you created any full or incremental backups of your system after creating the emergency recovery tapes, restore those backups using the restore method corresponding to the backup method you used to create them. For example, if you created backups using the cpio(1) command, use the same method to restore the archive. See SCO ARCserve/Open from Cheyenne in SCOhelp and the cpio(1) manual page for more information.