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.
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.
The default version of NFS is version 3. To use NFS version 2, ensure you use the option
-o -2 mount |
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 ChorusOS 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:chorus_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:chorus_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 chorus_root_directory is the path of the target root directory on the NFS host (for example /home/chorus/root).
A message is delivered by C_INIT
that depends
on whether the /etc/security file exists in the target
root directory /home/chorus/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/chorus/root directory can be accessed by NFS from the remote ChorusOS target.
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 |
host% rsh target mount host:/export/chorus/root / |
Mounts the ChorusOS root directory, /export/chorus/root, on host as the root directory on target.
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 |
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/chorus/root / can't access /export/chorus/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/chorus/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.
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
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 |
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.
host% rsh target mount -t ufs /dev/da0a / host% rsh target fsck /dev/rda0a host% rsh target mount -t ufs -o update /dev/da0a / |
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 |
host% rsh target mount -t msdos /dev/hd0a / |
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 |
host% rsh target mount -t cd9660 /dev/cd0a / |
Use the mount command without any arguments to view all mounted file systems:
host% rsh target mount |
Use the umount command to remove mounted_fs from the file system hierarchy:
host% rsh target umount mounted_fs |
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.
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 |
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 |
Copy the /bin, /etc and /lib directories to the RAM disk file system:
host% rsh target cp -R bin etc lib mnt_tmp/ |
Unmount all file systems on the target, including the root file system:
host% rsh target umount /mnt_tmp host% rsh target umount / |
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 bd0a hd0d hd1g hd3b ptyp1 rhd0e rhd1h rhd3c rda0c da0f bd0b hd0e hd1h hd3c rbflash rhd0f rhd2a rhd3d rda0d da0g bd0c hd0f hd2a hd3d rcflash rhd0g rhd2b rhd3e rda0e da0h bd0 hd0g hd2b hd3e rd0a rhd0h rhd2c rhd3f rda0f tty01 bpf0 hd0h hd2c hd3f rd0b rhd1a rhd2d rhd3g rda0g ttyp0 bpf1 hd1a hd2d hd3g rd0c rhd1b rhd2e rhd3h rda0h ttyp1 console hd1b hd2e hd3h rflash rhd1c rhd2f rrd0a da0a zero flash hd1c hd2f kmem rhd0a rhd1d rhd2g rrd0b da0b hd0a hd1d hd2g mem rhd0b rhd1e rhd2h rrd0c da0c hd0b hd1e hd2h null rhd0c rhd1f rhd3a rda0a da0d hd0c hd1f hd3a ptyp0 rhd0d rhd1g rhd3b rda0b da0e |
The first thing to do before mounting the root file system over NFS is to build a root file system for your target if you have not done so already. Further examples are provided in Chapter 8, Further File System Administration Examples .
Change to the directory where you build system images and make root:
$ cd build_dir $ make root |
If the root directory that is built under build_dir cannot be exported through NFS, move or copy it to a directory you can export:
$ cp -R build_dir/root exportable_dir |
Next, export the directory so that it is readable by the ChorusOS target system. On a host workstation running the Solaris operating environment, you can export the directory by adding a line to /etc/dfs/dfstab, similar to the following:
share -F nfs -o ro -d "target root dir" /export/ChorusOS/root
In order for the directory to be shared, restart the NFS server on the host workstation:
$ su Password: root password for host # /etc/init.d/nfs.server start |
You can then verify that the directory is indeed available:
$ showmount -e host /export/chorusOS/root (everyone) |
After you have verified that the target system root directory has been exported correctly on the host workstation, you may prepare a system image that mounts the directory during system initialization.
Make sure that the mount command is built into the ADMIN
system actor by setting the ADMIN_MOUNT
feature to true:
$ configurator -c conf/ChorusOS.xml -set ADMIN_MOUNT=true |
Make sure that the ChorusOS system can act as an NFS
client by setting the NFS_CLIENT
feature to true and the C_OS
buffer tunables to appropriately
large values:
$ configurator -c conf/ChorusOS.xml -set NFS_CLIENT=true $ configurator -c conf/ChorusOS.xml -set iom.nbuf=8 |
Add the necessary commands to configure the network interface and mount the directory to the system initialization script, sysadm.ini(4CC), located in build_dir/conf/sysadm.ini:
# # Set umask to 0 during system configuration. # umask 0 # # Prepare Ethernet and loopback interfaces so that you can access the # host workstation (129.157.197.144) where the root file system is # located. Target system IP address here is 129.157.197.88. # # Note that you do not have to use Ethernet as your network interface, # but Ethernet is simple to set up, so we have used it here to avoid # cluttering the example. # mkdev ifeth 0 mkdev lo 0 ifconfig ifeth0 129.157.197.88 netmask 0xffffff00 broadcast 129.157.197.255 ifconfig lo0 127.0.0.1 up # # Reset umask to default. # umask 22 # # During system initialization, the target mounts a pseudo / file # system, but you can mount a new root over the old one. So, mount the # root file system through NFS. # mount 129.157.197.144:/export/target/build/root / # # Display mount status to the console. # mount
Build and place the new system image where it can be downloaded onto the target and reboot the ChorusOS system. If you are using TFTP to download onto a PC target for example, then you might do so as follows:
$ cp chorus.bmon /tftpboot $ rsh target reboot |
After the system reboots, the mount information should appear on the console. You could also run one of the actors located under the root file system to verify that everything is functioning correctly:
$ rsh target ls /bin arp domainname ls pax tclsh chorusNSinet fsck mkdir pppstart touch chorusNSsite fsck_dos mkfifo profctl umount chorusStat ftp mknod profex uname cp hostname mount rdbc ypbind cs ifconfig mv rm ypcat date inetNSdns netstat rmdir ypmatch dd inetNShost newfs route ypwhich df inetNSien116 newfs_dos shutdown disklabel inetNSnis nfsstat sysctl |
This section explains how to activate a swap partition on a local disk that has already been labelled. The ChorusOS 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, label the partition as a swap partition using disklabel. See "Using disklabel to Label a Disk". After the partition is labelled, mount a swap directory using the mount command. Finally, activate the swap partition using the swapon command.
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.
Make a directory on the target to use as the mount point for the swap partition unless you have already done so:
$ rsh target ls swap_dir /swap_dir: No such file or directory $ rsh target mkdir swap_dir |
Make sure the partition you intend to use for swap has been correctly labelled using disklabel. See "Using disklabel to Label a Disk".
The partition you intend to use for swap should be labelled as type swap.
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.
Activate the swap partition using the swapon(1M) command:
$ rsh target swapon swap_dir |
A detailed example of creating a swap partition is also provided in "Creating and Activating a Swap Partition".