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.
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.
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 |
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.
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.
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
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 arun /bin/fsck raw_device |
where raw_device is a raw mode special file indicating the partition you mounted 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 / |
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 |
For example:
host% rsh target mount -t msdosfs /dev/hd0a / |
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 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 |
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 |
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 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 |
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.
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 arun /bin/ls swap_dir started aid = 22 /swap_dir: No such file or directory $ rsh target arun /bin/mkdir swap_dir |
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.
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 |
The following list reviews the file system utilities presented so far, and also includes a description of df(1CC) and flashdefrag(1M).
Writes disk geometry and other information to a disk attached to the target system.
Displays information about file system use such as total file system size, available space, inodes used and inodes available.
Defragements a Flash memory device attached to the target system.
Formats a Flash memory device attached to the target system.
Checks the integrity of a UFS file system and attempts to fix any errors it finds.
Checks the integrity of an MS-DOS file system and attempts to fix any errors it finds.
Creates a special device driver file corresponding to a device attached to the ChorusOS system.
Mounts a file system at a specified mount point in the existing file system hierarchy.
Writes a UFS file system structure to a labelled disk attached to the target system.
Writes an MS-DOS file system structure to a labelled disk attached to the target system.
Activates a local swap partition that you have mounted.
Removes a mounted file system from the file system hierarchy.