Chapter 6. Mounting and Unmounting File Systems

This chapter explains how to mount and unmount file systems.

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

6.1. File System Commands

The mount command, which is 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.

[Warning]Warning

The default version of NFS is version 3. To use NFS version 2, ensure you use the option

-o -2 mount

to mount commands.

Mounting the Host File System

To be able to download actors that are to run dynamically, mount an NFS root file system on the target. This root file system can be generated in the C5 operating system build directory by the command:

% make root

This command populates the build directory with the root directory that contains binary and configuration files to be accessed by the target system.

As explained, at start-up, the C_INIT daemon reads the sysadm.ini configuration file and executes all the commands. This configuration file may contain instructions to mount the root file system. For example:

% mount hostaddr:
C5_root_directory /

If there are no root file system mount instructions in your sysadm.ini file, mount the root file system explicitly from the shell:

% rsh target mount 
hostaddr:C5_root_directory /

where target is the name of the target, or its IP address, hostaddr is the IP address of the NFS host in decimal form (for example 192.82.231.1), and C5_root_directory is the path of the target root directory on the NFS host (for example /home/C5/root).

A message is delivered by C_INIT that depends on whether the /etc/security file exists in the target root directory /home/C5/root. If /etc/security exists, C_INIT displays:

C_INIT: system in secured mode

If /etc/security does not exist, C_INIT displays:

C_INIT: notice - system not in secured mode

You can check that the root file system is mounted using:

% rsh target mount

Make sure that the file system containing the /home/C5/root directory can be accessed by NFS from the remote C5 target.

Procedure 6.1. 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 6.1. Mounting a Root Directory through NFS

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

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

[Note]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/C5/root /

can't access /export/C5/root: Permission denied

This is the default for NFS version 3. If you are using NFS version 2, this is:

$ rsh target mount -o -2 129.157.197.144:/export/C5/root /

can't access /export/C5/root: Permission denied

This could happen if 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/C5/root   rw=netgroup
   ""  

See your Solaris system administrator for details about adding a system to a netgroup. This is so that you can configure your NFS server on your Solaris station so that it recognises the target and accepts the target as a client. For further information, see “Remote File-System Administration” in System Administration Guide, Volume 3.

[Note]Note

You can also receive a Permission denied message if access rights on the root directory are too restictives:

$ rsh target mount 129.157.197.144:/export/C5/root /

C_INIT: arun of /image/sys_bank/ADMIN.gz failed - Permission denied

The root directory must have at least drwxr-xr-x permissions mode.

Procedure 6.2. Mounting a UFS File System

[Note]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, 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 fsck raw_device

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

    Example 6.2. Mounting a UFS File System as the Root File System

    host% 
    rsh target mount -t ufs /dev/da0a /
    host% rsh target fsck /dev/rda0a
    
    host% rsh target mount -t ufs -o update /dev/da0a /
    

    Mounts the UFS file system on the first partition on the first SCSI drive attached to the C5 system, target, as the root file system.

Procedure 6.3. 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 msdos block_device 
    mount_point

    Example 6.3. Mounting an MS-DOS File System as the Root File System

    host% 
    rsh target mount -t msdos /dev/hd0a /

    Mounts the MS–DOS file system on the first partition on the first IDE drive attached to the C5 system, target, as the root file system.

Procedure 6.4. Mounting an ISO 9660 File System

[Note]Note

The ISO 9660 file system is used when mounting a CD-ROM. Its use is not, however, restricted to CD-ROM.

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

    host% rsh 
    target mount -t cd9660 block_device 
    mount_point

    Example 6.4. Mounting an ISO 9660 File System as the Root File System

    host% 
    rsh target mount -t cd9660 /dev/cd0a /

    Mounts the ISO 9660 file system on the first partition on the first CD-ROM drive attached to the C5 system, target, as the root file system.

Procedure 6.5. Viewing all Mounted File Systems

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

    host% rsh 
    target mount

Procedure 6.6. Unmounting a File System

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

    host% rsh 
    target umount mounted_fs

Procedure 6.7. 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 mkdir /mnt_tmp/dev
    host% rsh 
    target mkdir /mnt_tmp/image
    host% rsh 
    target mkdir /mnt_tmp/tmp
    
    
  3. Copy the /bin, /etc and /lib directories to the RAM disk file system:

    host% rsh 
    target cp -R bin etc lib mnt_tmp/
  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 ls /dev
    bd00            da0g            flash1b         hd1d            rflash0b
    bpf0            da0h            flash1c         hd1e            rflash0c
    bpf1            da1             hd0             hd1f            rflash1a
    cd0a            da1a            hd0a            hd1g            rflash1b
    cd0c            da1b            hd0b            hd1h            rflash1c
    cd1a            da1c            hd0c            kmem            rrd0a
    cd1c            da1d            hd0d            knvram          rrd0b
    console         da1e            hd0e            mem             rrd0c
    da0             da1f            hd0f            null            scd0
    da0a            da1g            hd0g            nvram0          tty01
    da0b            da1h            hd0h            rbd00           zero
    da0c            flash0a         hd1             rd0a
    da0d            flash0b         hd1a            rd0b
    da0e            flash0c         hd1b            rd0c
    da0f            flash1a         hd1c            rflash0a