ChorusOS 4.0 File System Administration Guide

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