ChorusOS 4.0 File System Administration Guide

Chapter 5 File System Commands

This chapter explains how to mount and unmount file systems. It also reviews useful file system utilities.

Before you can use most of the commands described in this chapter, you must first configure your hardware, system image and environment as described in previous chapters.

5.1 How to Mount and Unmount File Systems

The mount command--a C_INIT(1M) built-in command--allows you either to add a file system at a given point in an existing file system hierarchy, or to view all mounted file systems. Once mounted, a file system is fully operational. Applications can access it using the API provided.

The umount command, another C_INIT built-in command, allows you to remove one or more mounted file systems from the file system hierarchy.

Mounting an NFS File System

    Mount the file system under mount_dir on the host at mount_point on the target system:


    host% rsh target mount host:mount_dir mount_point
    

    Example 5-1 Mounting a Root Directory through NFS

    For example:


    host% rsh target mount host:/export/chorus/root /
    

    Mounts the ChorusOS root directory, /export/chorus/root, on host as the root directory on target.



Note -

In some cases, you may receive a Permission denied message when trying to mount an NFS file system.


$ rsh target mount 129.157.197.144:/export/chorus/root /
can't access /export/chorus/root: Permission denied

For example, perhaps the target system is not a member of a netgroup(4CC) that has at least read access to the NFS file system you want to mount. On a system running the Solaris operating environment, you can use share(1M) to see which netgroups have access to the shared file system:


$ rlogin 129.157.197.144
$ share
-               /export/chorus/root   rw=netgroup   ""  

See your system administrator for details about adding a system to a netgroup.


Mounting a UFS File System

Note -

When you mount a UFS file system as the root file system, mount first mounts the file system read-only. Next use fsck to check the file system. If the file system check finds and repairs errors, fsck then calls mount with the update option to mount the file system read-write. If the file system check terminates without finding any errors, you must call mount with the update option to mount the file system read-write


  1. Mount the file system on the partition block_device on the host at mount_point:


    host% rsh target mount -t ufs block_device mount_point
    
  2. If you have mounted the file system as the root file system, check it using the fsck command:


    host% rsh target arun /bin/fsck raw_device
    

    where raw_device is a raw mode special file indicating the partition you mounted as the root file system.


    Example 5-2 Mounting a UFS File System as the Root File System

    For example:


    host% rsh target mount -t ufs /dev/sd0a /
    host% rsh target arun /bin/fsck /dev/rsd0a
    host% rsh target mount -t ufs -o update /dev/sd0a /
    
    Mounts the UFS file system on the first partition on the first SCSI drive attached to the ChorusOS system, target, as the root file system.


Mounting an MS-DOS File System

    Mount the file system on the partition block_device on the host at mount_point:


    host% rsh target mount -t msdosfs block_device mount_point
    

    Example 5-3 Mounting an MS-DOS File System as the Root File System

    For example:


    host% rsh target mount -t msdosfs /dev/hd0a /
    
    Mounts the MS-DOS file system on the first partition on the first IDE drive attached to the ChorusOS system, target, as the root file system.


Viewing all Mounted File Systems

    Use the mount command without any arguments to view all mounted file systems:


    host% rsh target mount
    
Unmounting a File System

    Use the umount command to remove mounted_fs from the file system hierarchy:


    host% rsh target umount mounted_fs
    
Managing the /dev, /image and /tmp File Systems

In order to mount the /dev, /image and /tmp file systems automatically, thus providing access to special files and the contents of the system image for example, the C_INIT(1M) actor must find /dev, /image and /tmp mount points in the root file system.

If you create a file system that does not include these mount points, and then mount that file system as root (/), your target system will not have access to special files in /dev, nor to the contents of the system image under /image. Furthermore, function calls that rely on the presence of /tmp will not complete successfully.

Therefore, you should make sure /dev, /image and /tmp mount points are available in each file system that you use as a root file system.

  1. Create a temporary mount point for the file system that you want to use as a root file system and mount it.

    For example, if you have mounted an NFS file system located on the host workstation as the root file system, and you want to use an empty, existing IDEdisk UFS file system as the root file system:


    host% cd target_root_dir
    host% mkdir mnt_tmp
    host% rsh target mount -t ufs /dev/hd0a /mnt_tmp
    /dev/hd0a on /mnt_tmp
  2. Create the /dev, /image and /tmp mount points:


    host% rsh target arun /bin/mkdir /mnt_tmp/dev
    started aid = 22
    host% rsh target arun /bin/mkdir /mnt_tmp/image
    started aid = 22
    host% rsh target arun /bin/mkdir /mnt_tmp/tmp
    started aid = 22
  3. Copy the /bin, /etc and /lib directories to the RAM disk file system:


    host% rsh target arun /bin/cp -R bin etc lib mnt_tmp/
    started aid = 22
  4. Unmount all file systems on the target, including the root file system:


    host% rsh target umount /mnt_tmp
    host% rsh target umount /
    
  5. Mount the UFS file system as the root file system and make sure that /dev, for example, is accessible:


    host% rsh target mount -t ufs /dev/hd0a /
    host% rsh target arun /bin/ls /dev
    started aid = 22
    bd0a    hd0d   hd1g   hd3b   ptyp1   rhd0e  rhd1h  rhd3c  rsd0c  sd0f
    bd0b    hd0e   hd1h   hd3c   rbflash rhd0f  rhd2a  rhd3d  rsd0d  sd0g
    bd0c    hd0f   hd2a   hd3d   rcflash rhd0g  rhd2b  rhd3e  rsd0e  sd0h
    bd0     hd0g   hd2b   hd3e   rd0a    rhd0h  rhd2c  rhd3f  rsd0f  tty01
    bpf0    hd0h   hd2c   hd3f   rd0b    rhd1a  rhd2d  rhd3g  rsd0g  ttyp0
    bpf1    hd1a   hd2d   hd3g   rd0c    rhd1b  rhd2e  rhd3h  rsd0h  ttyp1
    console hd1b   hd2e   hd3h   rflash  rhd1c  rhd2f  rrd0a  sd0a   zero
    flash   hd1c   hd2f   kmem   rhd0a   rhd1d  rhd2g  rrd0b  sd0b
    hd0a    hd1d   hd2g   mem    rhd0b   rhd1e  rhd2h  rrd0c  sd0c
    hd0b    hd1e   hd2h   null   rhd0c   rhd1f  rhd3a  rsd0a  sd0d
    hd0c    hd1f   hd3a   ptyp0  rhd0d   rhd1g  rhd3b  rsd0b  sd0e

5.2 How to Activate a Swap Partition

This section explains how to activate a swap partition on a local disk that has already been labelled. The ChorusOS 4.0 product supports a single swap partition on a local disk, unlike earlier releases that supported swap over NFS.

In order to use a swap partition on a ChorusOS system, you must first label the partition as a swap partition using disklabel. After the partition is labelled, you mount a swap directory using the mount command. Finally, you activate the swap partition using the swapon command.


Note -

Swap cannot be deactivated.


After you have performed the procedure once, you can mount and activate the swap partition during system intilization by including the necessary commands in the sysadm.ini file that you build into the system image.

Preparing and Activating a Swap Partition
  1. Make a directory on the target to use as the mount point for the swap partition unless you have already done so:


    $ rsh target arun /bin/ls swap_dir
    started aid = 22
    /swap_dir: No such file or directory
    $ rsh target arun /bin/mkdir swap_dir
    
  2. Make sure the partition you intend to use for swap has been correctly labelled using disklabel.

    The partition you intend to use for swap should be labelled as type swap.

  3. Mount the swap directory:


    $ rsh target mount -t swap block_special_file swap_dir
    

    Where block_special_file represents the partition you labelled as type swap.

  4. Activate the swap partition using the swapon(1M) command:


    $ rsh target swapon swap_dir
    

5.3 File System Utilities

The following list reviews the file system utilities presented so far, and also includes a description of df(1CC) and flashdefrag(1M).

disklabel

Writes disk geometry and other information to a disk attached to the target system.

df

Displays information about file system use such as total file system size, available space, inodes used and inodes available.

flashdefrag

Defragements a Flash memory device attached to the target system.

format

Formats a Flash memory device attached to the target system.

fsck

Checks the integrity of a UFS file system and attempts to fix any errors it finds.

fsck_dos

Checks the integrity of an MS-DOS file system and attempts to fix any errors it finds.

mknod

Creates a special device driver file corresponding to a device attached to the ChorusOS system.

mount

Mounts a file system at a specified mount point in the existing file system hierarchy.

newfs

Writes a UFS file system structure to a labelled disk attached to the target system.

newfs_dos

Writes an MS-DOS file system structure to a labelled disk attached to the target system.

swapon

Activates a local swap partition that you have mounted.

umount

Removes a mounted file system from the file system hierarchy.