The goal of this chapter is to provide the information necessary for you to perform the following tasks:
Invoke the UNIX shell from the text-based or graphical user interface
Access devices
Mount file systems
Restore UFS or AdvFS file systems
Use the
disklabel
command to change the size of
disk partitions
Access Logical Storage Manager (LSM) volumes
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 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:
Restoring a damaged
root
file system
Checking the consistency of the
root
file system
Restoring the boot block image
Performing disk maintenance operations such as changing the disk partition layout before performing a text-based custom installation
Correcting errors in LSM volumes used for
root
( / ) or
/usr
file systems or
the primary swap
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 operating system 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
You can get more information about a question by entering: help
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 operating system 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:
Edit a file with
the
ed
text editor.
By default the
EDITOR
environment
variable is set to
ed.
On systems with VGA monitors, you can enable
the
vi
text editor by entering:
#TERM=vt100#export TERM
Create new file systems with the
newfs
command
for UNIX File Systems (UFS) or with the
mkfdmn
and
mkfset
commands for Advanced File Systems (AdvFS).
Restore file systems with the
restore
command (for
UFS) or the
vrestore
command (for AdvFS).
Modify partition tables with the
disklabel
command
before the custom installation if you are using the text-based interface.
Otherwise,
use the graphical Disk Configuration Utility,
diskconfig, which
is accessed by clicking on the
Partition Disks...
button on the
Installation Setup
window.
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.
Mount other disks and file systems with the
mount
command.
Fix UFS file systems with the
fsck
command.
The
fsck
command is not required for AdvFS file systems.
Note
The
rootfile system located on the CD-ROM or the RIS server is mounted with read permissions. The memory file systems (MFS) at/varand/devare mounted with read-write permissions. However, any changes that you make on files that you create inrootare 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 previously has been used for swap space.
Follow these steps to turn on swapping in the UNIX shell:
Decide which device (that is, the device name and partition) you want to use for the swap area. Be careful not to choose an area that has data that you want to preserve.
Change to the
/dev
directory:
#cd /dev
Use the
MAKEDEV
command with the following syntax
to make the device special file for the swap area:
./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
Turn the swap device on.
In this example, the swap device is
rz0h:
#swapon /dev/rz0h
Enter the following command to verify that the swap device is turned on:
#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:
Change to the
/dev
directory by entering:
#cd /dev
Use the
MAKEDEV
command to create the disk device
special file for rz0 by entering:
#./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 9.9
for information about how to start LSM.
To mount an existing
root
file system located on
/dev/rz0a, execute the following commands:
Create the device special files for the disk containing the
root
file system:
#cd /dev#./MAKEDEV rz0
To prepare to mount the file system, create a mount point in
/var
or
/tmp:
#mkdir /var/mnt
Mount the file system:
For UNIX file systems (UFS), enter:
#mount /dev/rz0a /var/mnt
For Advanced File Systems (AdvFS), enter:
#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 9.5.
If your system is using the Logical Storage Manager (LSM) volume
rootvol
for the
root
file system, refer to
Section 9.9
for information about how to start LSM in the UNIX shell.
Use the following procedure to restore a UNIX file system:
If the disk does not have a label, which could occur
if the disk was physically damaged or replaced, write the default disk partition tables
and bootstrap programs.
The disk partitions and bootstrap programs should be operational.
To determine if the disk has a valid label, use the
disklabel
command with the following syntax:
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
disklabelcommand 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 thedisklabelcommand after writing the default disk label. Refer to System Administration or to thedisklabel(8) reference page for more information.
Create a new
root
file system by using the following command syntax:
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
To prepare to mount the file system, create a mount point in
/var
or
/tmp:
#mkdir /var/mnt
You should create mount points under the
/var
or
/tmp
directories.
Mount the file system by using the following command syntax:
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
Next, restore the file system.
If you are restoring dump files from
a local file system, change to the
/var/mnt
directory, insert the
medium containing the dump file, and enter the
restore
command
with the following command syntax:
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.
You should restore
file systems 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 9.4.
Use the following procedure to restore AdvFS file systems:
If the disk does not have a label, which could occur
if the disk was physically damaged or replaced, write the default disk partition tables
and bootstrap programs.
The disk partitions and bootstrap programs should be operational.
To determine if the disk has a valid label, use the
disklabel
command with the following syntax:
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
disklabelcommand 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 thedisklabelcommand after writing the default label. Refer to System Administration or to thedisklabel(8) reference page for more information.
Create a new
root
file domain by using the following
command syntax:
mkfdmn
-t disk_typeraw_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/rz0a root_domain
Create a
root
fileset in the
root_domain
file by using the following command:
#mkfsetdomain 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
To prepare to mount the fileset, create a mount point in
/var
or
/tmp:
#mkdir /var/mnt
You should create mount points under the
/var
or
/tmp
directories.
Mount the
root
fileset by using the following command
syntax:
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
Restore the fileset using the
vrestore
command.
To restore files from a local file system, change to the
/var/mnt
directory, insert the medium containing the dump file, and enter the
vrestore
command using the following syntax:
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
rootfile system to AdvFS) and you can make avdumptape on UFS. The restore command you use depends on the format of the tape(dumporvdump). Usevrestoreto restore AdvFS dumps performed with thevdumpcommand andrestoreto restore dumps performed with thedumpcommand. The corresponding restore command is used regardless of the target file system type.
You can use the UNIX shell to restore
other file systems.
You should restore file systems 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
Verify the
/etc/fstab
and
/etc/fdmns
directories.
The
mkfdmn
command added
/etc/fdmns/root_domain
to the
root
file system in the UNIX shell that is deleted
when you exit the UNIX shell.
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
If you have a VGA monitor and want
disklabelto use thevieditor, you first have to set the following variables:#TERM=vt100#export TERM#EDITOR=vi#export EDITOR
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/rzn
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.
Change to the
/dev
directory:
#cd /dev
Use the
MAKEDEV
command to create the disk device
special files for
rz0:
#./MAKEDEV rz0
Check the disk label information on
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
aorcpartition of the disk while it is open. This sometimes requires that the label 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 theapartition.
Set the EDITOR environment variable to use the
ed
editor:
#EDITOR=ed#export EDITOR
Note
If you have a VGA monitor and want to use the
vieditor, you first have to set the following variables:#TERM=vt100#export TERM#EDITOR=vi#export EDITOR
The examples shown in the remaining steps use the
ed
text
editor.
Edit the disk label for
rz0:
#disklabel -e rz0
Display the disk label by entering the following command:
1,$p
Search for the
b
partition by entering the following
command:
/b:
Information similar to the following is displayed:
b: 262144 131072 unused 1024 8192 # (Cyl. 164*- 492*)
Change the size of the
b
partition from 262144
sectors to 131072 sectors by entering the following command:
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 modified automatically when you save and exit the file.
Search for the
g
partition by entering the following
command:
/g:
Information similar to the following is displayed:
g: 819200 393216 unused 1024 8192 # (Cyl. 492*- 1519*)
Because the size of the
b
partition was reduced
by 131072 sectors, the size of the
g
partition should be increased
by 131072 sectors.
Change the size of the
g
partition from 819200
sectors to 950272 sectors by entering the following command:
s/819200/950272/p
This increases the size of the
g
partition from 400 MB to 464 MB.
Change the offset of the
g
partition by entering
the following command:
s/393216/262144/p
The revised information is displayed:
g: 950272 262144 unused 1024 8192 # (Cyl. 402*- 1519*)
To verify your changes, redisplay the disk label by entering the following command:
1,$p
Save your edits and quit the editor by entering the following command:
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]
Display the newly customized disk by entering the following command:
#disklabel -r rz0
Make sure you are in the
root
directory ( cd / ).
Then, restart the installation by entering the
restart
command:
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 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
You can get more information about a question by entering: help
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 plub 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:
Create device special files for at least one disk that has a valid LSM configuration database:
#cd /dev#./MAKEDEV rz9 rz10#cd /
Create LSM device special files:
#mknod /dev/volconfig c 41 0#mknod /dev/volevent c 41 1#mknod /dev/voliod c 41 2#mknod /dev/volinfo c 41 3
Start the LSM error daemons,
voliod:
#voliod set 2#mkdir /etc/vol
Start the LSM configuration daemon in
disable
mode:
#vold -m disable
Initialize the
/etc/vol/volboot
file:
#voldctl init
Add one of the disks containing the LSM configuration database to
the
/etc/vol/volboot
file:
#voldctl add disk rz9
Put
vold
in the
enabled
mode
and import all LSM diskgroups:
#voldctl enable
Get a list of all disks known to LSM:
#voldisk list
Make sure that all
disks have a device special files in
/dev.
Execute the
volprint
command to obtain information
about the LSM configuration:
#volprint -htA
Start the LSM volumes:
#volume -gdiskgroup-Uusetypestartvolume_name
To rectify problems in a file, the volume needs to be mounted.
For
example, the
root
file system may have to be mounted to fix a file
such as
/etc/vol/volboot
or
/etc/inittab.
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 used under the 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:
Create a disk label based on the contents of the ULTRIX partition table
Create a disk label based on the default operating system partition
information found in
/etc/disktab
The following is an example of an ULTRIX partition table:
ULTRIX compatible partition data found.
This data may be different than the standard
partition layout information in /etc/disktab.
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
Use the ULTRIX-style partition data? [y]: n
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.
After performing preinstallation, system maintenance, or troubleshooting activities in the UNIX shell, return to the installation procedure by entering the following command:
#cd /#restart
If you have a system console with graphics capability and you want to restart the installation procedure with the text-based interface instead of the graphical user interface, enter the following command:
#cd /#restart nogui
To exit from the UNIX shell and log in to your already installed system,
as superuser or
root
enter:
#halt
When the console mode prompt
( >>> ) displays, enter:
>>>bootsystem_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.