The goal of this chapter is to provide the information necessary for you to perform the following tasks:
The primary purpose of the UNIX shell option is to provide a way to perform disk and file system maintenance before the installation and to perform disaster recovery processes. The UNIX shell provides a way to access all UNIX commands that help you recover from serious problems such as root file system corruption and enables you to perform general file system and disk maintenance tasks.
The distribution media (CD-ROM or RIS) contains file systems that are laid out just as the software would be installed on the system and provides direct access to the root, /usr, and /var directories. This format makes almost every Digital UNIX command and utility available in the UNIX shell even if your operating system is not yet fully functional. In effect, the mounted distribution media is a full operating system environment.
You should perform system management activities in the UNIX shell only if you have extensive UNIX operating system experience and a full operating system environment is not available.
The following system management activities can be performed from the UNIX shell:
How you invoke the UNIX shell from the installation procedure depends upon whether you are using the graphical or text-based interface. When you invoke the UNIX shell option, the system is in a Bourne shell in single-user mode with superuser privileges.
After you boot your processor from the Digital UNIX distribution media, your screen will look similar to the following:
Welcome to the Digital UNIX Installation Procedure
This procedure installs Digital UNIX onto your system. You will be asked a series of system configuration questions. Until you answer all questions, your system is not changed in any way.
During the question and answer session, you can go back to any previous question and change your answer by entering: history
There are two types of installations:
o The Default Installation installs a mandatory set of software subsets on a predetermined file system layout.
o The Custom Installation installs a mandatory set of software subsets plus optional software subsets that you select. You can customize the file system layout.
The UNIX Shell option puts your system in single-user mode with superuser privileges. This option is provided for experienced UNIX system administrators who want to perform file system or disk maintenance tasks before the installation.
The Installation Guide contains more information about installing Digital UNIX.
1) Default Installation 2) Custom Installation 3) UNIX Shell
Enter your choice:
Choose option 3 from the menu to access the UNIX shell option.
After you boot your processor from the Digital UNIX distribution media, the Installation Setup screen displays. Invoke the UNIX shell from the button labeled UNIX shell.
The UNIX shell is an environment that has most of the capabilities of a full operating system environment. This environment works without a swap device and with very limited free disk space within the memory file system (MFS). These two factors mean that tasks requiring large amounts of memory that create the need to swap or tasks requiring large amounts of disk space (such as /tmp space) are likely to encounter failures in the UNIX shell environment.
Use the UNIX shell to perform the following tasks:
#
TERM=vt100
#
export TERM
Remember to use the -t advfs or -t ufs option with the disklabel command depending upon which file system type is in use (AdvFS or UFS) for the root file system. Boot blocks must match the file system type of root. Refer to the disklabel(8) reference page for more information.
Note
The root file system located on the CD-ROM or the RIS server is mounted with read permissions. The memory file systems (MFS) at /var and /dev are mounted with read-write permissions. However, any changes that you make on files that you create in root are volatile and will not be saved when you halt the UNIX shell.
If you need to perform a task that needs swap space, you can turn swapping on in the UNIX shell. The only suggestion for turning on swap space in the UNIX shell environment is that you should not use an area that contains data you want to preserve because it will be overwritten. To avoid this problem, use an area that has previously been used for swap space.
Follow these steps to turn on swapping in the UNIX shell:
#
cd /dev
./MAKEDEV swap_device
For example, to create a swap area on device rz0 in the h partition, enter a command similar to the following:
#
./MAKEDEV rz0h
#
swapon /dev/rz0h
#
swapon -s
Device special files must be present in the /dev directory to access your system's disk and tape devices. Enter the ls /dev command to see if the required device special files exist. If these files do not exist, use the MAKEDEV command to create them.
For example, to create the device special file for a SCSI disk, unit number 0 (zero), execute the following commands:
#
cd /dev
#
./MAKEDEV rz0
The UNIX shell is used to perform maintenance operations on existing file systems. For instance, if the kernel (vmunix) on your root file system becomes damaged and you have a good backup, you can mount your root file system and replace the damaged kernel. If you are using LSM volumes for the root file system, refer to Section 7.9 for information about how to start LSM.
To mount an existing root file system located on /dev/rz0a, execute the following commands:
#
cd /dev
#
./MAKEDEV rz0
#
mkdir /var/mnt
#
mount /dev/rz0a /var/mnt
#
mkdir -p /etc/fdmns/root_domain
#
cd /etc/fdmns/root_domain
#
ln -s /dev/rz0a
#
mount root_domain#root /var/mnt
The existing root file system is accessible at /var/mnt and can be modified at this point.
The UNIX shell is ideal for restoring damaged root file systems. To restore your root file system, first create the device special files for the disk on which the root file system is to reside. Next create the device special files for the tape device that contains the dump of the root file system to be restored. Create these device special files using the MAKEDEV command as shown in Section 7.5.
If your system is using the Logical Storage Manager (LSM) volume rootvol for the root file system, refer to Section 7.9 for information about how to start LSM in the UNIX shell.
Use the following procedure to restore a UNIX file system:
disklabel -r disk
If there is no disk label, a message displays.
If a disk label does not exist, use the disklabel command with the following syntax to write the default disk partition table:
disklabel -rw -t ufs disk disk_type
The -t ufs specifies that the UNIX file system bootstrap programs are installed. The disk parameter specifies the disk that includes the device mnemonic and unit number. The disk_type parameter specifies the type of disk associated with disk as described in the /etc/disktab file.
For example, to write the default disk partition
tables on an RZ57 disk, unit 0, on the
a
partition, enter the following command:
#
disklabel -rw -t ufs rz0 rz57
Note
The disklabel command used in this procedure writes the default disk partition tables to the disk. Writing a label with customized partition table settings may affect the entire disk. If the disk you are restoring has customized partition table settings, invoke the editing option of the disklabel command after writing the default disk label. Refer to System Administration or to the disklabel(8) reference page for more information.
newfs raw_device disk_type
The
raw_device
parameter specifies the full raw device pathname of the disk device
on your
system. For example, to create a new file system on an RZ57, unit
0, enter the
following command:
#
newfs /dev/rrz0a rz57
#
mkdir /var/mnt
Digital suggests creating mount points under the /var or /tmp directories.
mount block_device /var/mnt
The
block_device
parameter specifies the full block device pathname of the disk
device. For
example, to mount the file system created in the previous step,
enter the
following command:
#
mount /dev/rz0a /var/mnt
restore -Yrf dumpfile
The
dumpfile
parameter specifies the pathname of the file containing the dump
data. For a
tape, enter the following commands:
#
cd /var/mnt
#
restore -Yrf /dev/rmt0h
You can use the UNIX shell to restore other file systems. Digital recommends performing file system restores from a full operating system environment. If such an environment is unavailable due to the need to restore either /var or /usr, you should boot your system to single-user mode by using your existing or restored root file system. In the single-user mode, more disk space is available, and swap space can be made available in the UNIX shell as shown in the instructions in Section 7.4.
Use the following procedure to restore AdvFS file systems:
disklabel -r disk
If the disk has no label, a message is displayed. If the disk has no label, use the disklabel command with the following syntax to write the default disk partition table:
disklabel -rw -t advfs disk disk_type
The -t advfs option must be used when creating an AdvFS root fileset to ensure that the correct boot blocks are in use in the boot partition. The disk parameter specifies the disk that includes the device mnemonic and unit number. The disk_type parameter specifies the type of disk associated with disk as described in the /etc/disktab file. For example, to write the default disk partition tables on an RZ57 disk, unit 0, enter the following command:
#
disklabel -rw -t advfs rz0 rz57
Note
The disklabel command used in this procedure writes the default disk partition tables to the disk. Writing a label with customized partition table settings may affect the entire disk. If the disk you are restoring has customized partition table settings, invoke the editing option of the disklabel command after writing the default label. Refer to System Administration or to the disklabel(8) reference page for more information.
mkfdmn -t disk_type raw_device domain
The
raw_device
parameter specifies the full raw device pathname of the disk device
on your
system. For example, to create a new file system on an RZ57, unit
0, enter the
following command:
#
mkfdmn -t rz57 /dev/rrz0a root_domain
#
mkfset
domain fileset
The domain parameter specifies the name of the root file domain. For example, to create the root fileset in the root_domain file domain, enter the following command:
#
mkfset root_domain root
#
mkdir /var/mnt
Digital suggests creating mount points under the /var or /tmp directories.
mount domain#fileset mount_point
The
domain#fileset
parameter specifies the
root
file domain and the
root
fileset. The
block_device
parameter specifies the full block device pathname of the disk
exist (directories
are created using the
mkdir
command).
For example, to mount the fileset created in the previous
steps, enter the following command:
#
mount root_domain#root /var/mnt
vrestore -vxf dumpfile
The
dumpfile
parameter specifies the pathname of the file containing the dump
data. Enter the following commands for a tape:
#
cd /var/mnt
#
vrestore -vxf /dev/rmt0h
Note
You can restore a UFS format dump tape to AdvFS (for instance if you are converting a UFS root file system to AdvFS) and you can make a vdump tape on UFS. The restore command you use depends on the format of the tape (dump or vdump). Use vrestore to restore AdvFS dumps performed with the vdump command and restore to restore dumps performed with the dump command. The corresponding restore command is used regardless of the target file system type.
You can use the UNIX shell to restore other file systems. Digital recommends performing file system restores from a full operating system environment. If such an environment is unavailable due to the need to restore either /var or /usr, you should boot your system to single-user mode by using your existing or restored root file system. In the single-user mode, more disk space is available, and swap space can be made available by issuing the following command:
#
swapon -a
If you are using the text-based installation interface, use the disklabel command and if you are using the graphical installation interface, use the Disk Configuration application to change the drive identification or the disk partitions on the drive or to replace a damaged label or bootstrap. Remember to use the -t advfs or -t ufs option with the disklabel command depending upon which file system type is in use (AdvFS or UFS). UFS boot blocks are installed by default if -t advfs is not specified. Refer to the disklabel(8) reference page for more information.
Note
You must be experienced with the ed editor when using the disklabel command in the UNIX shell.
To look at the existing disk partition layout, enter the
disklabel
command in the following format and replace the variable
n
with the unit number of the disk. For example, to look at the existing
disk partition layout of an
rz
SCSI disk, enter the following command:
#
disklabel -r /dev/rz
n
In the previous example, n is the unit number of the disk. The system displays the existing disk partition layout.
To change the size of the disk partition, complete the following steps. The following example uses an rz26 disk, unit number 0. In this example, the size of the b partition is decreased and the size of the g partition is increased to include the space no longer being used by the b partition.
#
cd /dev
#
./MAKEDEV rz0
#
disklabel -r rz0
If there is no label, the following message is displayed:
Bad pack magic number (label is damaged, or pack is unlabeled)
To label the disk with the default partitions with AdvFS boot blocks, enter the following command:
#
disklabel -rw -t advfs rz0 rz26
Note
The kernel device drivers do not allow the size of a disk partition to be decreased or the offset of a partition to be changed while it is open. Some device drivers create a label containing only a single large partition if a disk is unlabeled; thus the label must be written to the a or c partition of the disk while it is open. This sometimes requires the desired label to be set in two steps, the first one creating at least one other partition, and the second setting the label on the new partition while shrinking the a partition.
#
EDITOR=ed
#
export EDITOR
Note
If you have a VGA monitor and want to use the vi editor, you first have to set the TERM variable:
# TERM=vt100
# export TERM
# EDITOR=vi
# export EDITOR
The examples shown in the remaining steps use the ed text editor.
#
disklabel -e rz0
1,$p
/b:
Information similar to the following is displayed:
b: 262144 131072 unused 1024 8192 # (Cyl. 164*- 492*)
s/262144/131072/p
This reduces the size of the b partition from 128 MB to 64 MB. The revised information is displayed:
b: 131072 131072 unused 1024 8192 # (Cyl. 164*- 402)
There is no need to modify cylinder information; cylinder information is automatically modified when you save and exit the file.
/g:
Information similar to the following is displayed:
g: 819200 393216 unused 1024 8192 # (Cyl. 492*- 1519*)
s/819200/950272/p
This increases the size of the g partition from 400 MB to 464 MB.
s/393216/262144/p
The revised information is displayed:
g: 950272 262144 unused 1024 8192 # (Cyl. 402*- 1519*)
1,$p
wq
The system prompts if you want to write the new label. If you are satisfied with your changes, press Return to accept the default answer, y.
Write new label? [y]
[Return]
#
disklabel -r rz0
Choose the custom installation by entering the number 2 at the prompt. If you choose the default installation option, the changes you made to the disk label will be lost because the default partitions are always used on the disk that contains the root file system.
Welcome to the Digital UNIX Installation Procedure
This procedure installs Digital UNIX onto your system. You will be asked a series of system configuration questions. Until you answer all questions, your system is not changed in any way.
During the question and answer session, you can go back to any previous question and change your answer by entering: history
There are two types of installations:
o The Default Installation installs a mandatory set of software subsets on a predetermined file system layout.
o The Custom Installation installs a mandatory set of software subsets plus optional software subsets that you select. You can customize the file system layout.
The UNIX Shell option puts your system in single-user mode with superuser privileges. This option is provided for experienced UNIX system administrators who want to perform file system or disk maintenance tasks before the installation.
The Installation Guide contains more information about installing Digital UNIX.
1) Default Installation 2) Custom Installation 3) UNIX Shell
Enter your choice:
If the LSM daemons vold and voliod fail to restart when your system is rebooted or the LSM configuration database is corrupted, the LSM volume on which the root file system exists will not be accessible. Under such circumstances your system cannot be brought up to multiuser mode. To repair possible problems in /etc/vol/volboot or the rootdg diskgroup, use LSM commands to rectify the problem.
Use commands similar to the following to restart LSM in the UNIX shell:
#
cd /dev
#
./MAKEDEV rz9 rz10
#
cd /
#
mknod /dev/volconfig c 41 0
#
mknod /dev/volevent c 41 1
#
mknod /dev/voliod c 41 2
#
mknod /dev/volinfo c 41 3
#
voliod set 2
#
mkdir /etc/vol
#
vold -m disable
#
voldctl init
#
voldctl add disk rz9
#
voldctl enable
#
voldisk list
Make sure that all disks have a device special files in /dev.
#
volprint -htA
#
volume -g
diskgroup
-U
usetype
start
volume_name
If the root file system was using AdvFS as the file system type, enter commands similar to the following to mount it:
#
mkdir -p /etc/fdmns/root_domain
#
cd /etc/fdmns/root_domain
#
ln -s /dev/vol/rootdg/rootvol rootvol
#
mount root_domain#root /mnt
If the root file system was using UFS as the file system type, the LSM volume rootvol is mounted as follows:
#
fsck /dev/rvol/rootdg/rootvol
#
mount /dev/vol/rootdg/rootvol /mnt
Refer to the Logical Storage Manager guide for more information about how to correct problems encountered while enabling LSM or starting LSM volumes.
Any disk that was in use under Digital's ULTRIX operating system will have a partition table. In such cases, the disklabel command displays the ULTRIX partition information and gives you the following options:
The following is an example of the ULTRIX partition table:
ULTRIX compatible partition data found. This data may be different than the standard partition layout information in /etc/disktab.Use the ULTRIX-style partition data? [y]: n
ULTRIX partition table layout is: partition bottom top size overlap a 0 32767 32768 c b 32768 163839 131072 c c 0 2050859 2050860 a,b,d,e,f,g,h d 163840 792845 629006 c,g e 792846 1421851 629006 c,g,h f 1421852 2050859 629008 c,h g 163840 983039 819200 c,d,e h 983040 2050859 1067820 c,e,f
If you want to preserve the ULTRIX partition data, enter y at the prompt; otherwise, enter n. If you changed the partition data, the installation procedure recognizes the changes to the disk label and prompts if you want to use the customized partition layout or the default layout. To preserve your changes, choose the customized partition layout.
You must be at the root directory to restart the installation from the UNIX shell.
#
cd /
#
restart
#
cd /
#
restart nogui
#
halt
When the console mode prompt (>>>) displays, enter:
>>>
boot
system_disk
Replace system_disk with the device where the current root file system is located. The system disk is usually an entry such as DKA0.