[Return to Library]  [TOC]  [PREV]  SECT--  [NEXT]  [INDEX] [Help]

7    UNIX Shell Option

The goal of this chapter is to provide the information necessary for you to perform the following tasks:


[Return to Library]  [TOC]  [PREV]  SECT--  [NEXT]  [INDEX] [Help]

7.1    What Is the UNIX Shell Option?

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:


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.2    Invoking 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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.2.1    Invoking the UNIX Shell from the Text-Based Interface

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
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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.2.2    Invoking the UNIX Shell from the Graphical Interface

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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.3    UNIX Shell Capabilities

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:


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.



[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.4    Creating Swap Space

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:

  1. 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.

  2. Change to the /dev directory:
    # cd /dev

  3. Use the MAKEDEV command with the following syntax to make the device special file for the swap area:

    ./MAKEDEVswap_device

    For example, to create a swap area on device rz0 in the h partition, enter a command similar to the following:

    # ./MAKEDEV rz0h

  4. Turn the swap device on. In this example, the swap device is rz0h:
    # swapon /dev/rz0h

  5. Enter the following command to verify that the swap device is turned on:
    # swapon -s


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.5    Accessing Devices

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:

  1. Change to the /dev directory by entering:
    # cd /dev

  2. Use the MAKEDEV command to create the disk device special file for rz0 by entering:
    # ./MAKEDEV rz0


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.6    Mounting File Systems

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:

  1. Create the device special files for the disk containing the root file system:
    # cd /dev
    
    # ./MAKEDEV rz0

  2. To prepare to mount the file system, create a mount point in /var or /tmp:
    # mkdir /var/mnt

  3. Mount the file system:

    1. For UNIX file systems (UFS), enter:
      # mount /dev/rz0a /var/mnt

    2. 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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.7    Restoring File Systems

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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.7.1    Restoring UNIX File Systems (UFS)

Use the following procedure to restore a UNIX file system:

  1. 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 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.


  2. Create a new root file system by using the following command syntax:

    newfsraw_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

  3. To prepare to mount the file system, create a mount point in /var or /tmp:
    # mkdir /var/mnt
    Digital suggests creating mount points under the /var or /tmp directories.

  4. Mount the file system by using the following command syntax:

    mountblock_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

  5. 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. 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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.7.2    Restoring Advanced File Systems (AdvFS)

Use the following procedure to restore AdvFS file systems:

  1. 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 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.


  2. Create a new root file domain by using the following command syntax:

    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/rz0a root_domain

  3. Create a root fileset in the root_domain file by using the following command:
    # 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

  4. To prepare to mount the fileset, create a mount point in /var or /tmp:
    # mkdir /var/mnt
    Digital suggests creating mount points under the /var or /tmp directories.

  5. Mount the root fileset by using the following command syntax:

    mountdomain#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

  6. 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 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

  7. 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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.8    Changing the Size of a Disk Partition

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 disklabel to use the vi editor, 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.

  1. Change to the /dev directory:
    # cd /dev

  2. Use the MAKEDEV command to create the disk device special files for rz0:
    # ./MAKEDEV rz0

  3. 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 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.


  4. 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 vi editor, 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.

  5. Edit the disk label for rz0:
    # disklabel -e rz0

  6. Display the disk label by entering the following command:
    1,$p

  7. 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*)

  8. 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 automatically modified when you save and exit the file.

  9. 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*)

  10. 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.

  11. 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*)

  12. To verify your changes, redisplay the disk label by entering the following command:
    1,$p

  13. 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]

  14. Display the newly customized disk by entering the following command:
    # disklabel -r rz0

  15. 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:


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.9    Starting the Logical Storage Manager

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:

  1. Create device special files for at least one disk that has a valid LSM configuration database:
    # cd /dev
    
    # ./MAKEDEV rz9 rz10
    
    # cd /

  2. 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

  3. Start the LSM error daemons, voliod:
    # voliod set 2
    
    # mkdir /etc/vol

  4. Start the LSM configuration daemon in disable mode:
    # vold -m disable

  5. Initialize the /etc/vol/volboot file:
    # voldctl init

  6. Add one of the disks containing the LSM configuration database to the /etc/vol/volboot file:
    # voldctl add disk rz9

  7. Put vold in the enabled mode and import all LSM diskgroups:
    # voldctl enable

  8. Get a list of all disks known to LSM:
    # voldisk list
    Make sure that all disks have a device special files in /dev.

  9. Execute the volprint command to obtain information about the LSM configuration:
    # volprint -htA

  10. Start the LSM volumes:
    # volume -g diskgroup -U usetype start volume_name

  11. 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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.10    Using a Disk That Contains ULTRIX Partition Information

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.

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.


[Return to Library]  [TOC]  [PREV]  --SECT  SECT--  [NEXT]  [INDEX] [Help]

7.11    Returning to the Installation Procedure from the UNIX Shell

You must be at the root directory to restart the installation from the UNIX shell.