Solaris Transition Guide

Using File System Administration Commands

The file system administration commands that have changed in the SunOS release 5.7 software include:

Mounting File Systems and autofs

The biggest change to the mounting capability is automatic mounting or autofs. The autofs program automatically mounts directories when you access them using, for example cd(1) or ls(1). This capability includes file hierarchies, CD-ROM, and diskette file systems.

autofs starts automatically when the system enters run level 3, or you can invoke it from a shell command line.

autofs works with the file systems specified in maps. These maps can be maintained as NIS, NIS+, or local files. The autofs maps can specify several remote locations for a particular file. This way, if one of the servers is down, autofs can try to mount from another system. You can specify in the maps which servers are preferred for each resource by assigning each server a weighting factor.

Mounting some file hierarchies with autofs does not exclude the ability to mount others with the mount command. A diskless system must have entries for / (root), /usr, and /usr/kvm in the /etc/vfstab file. Because shared file systems should always remain available, do not use autofs to mount /usr/share.

The following example shows how to manually mount a file system listed in the /etc/vfstab file using the mount command.

  1. Change to the directory in which you want to create the mount point.

  2. Create the mount-point directory.

  3. Specify either the mount point or the block device.

    Specifying the mount point is usually easier. The rest of the information is read from /etc/vfstab.

  4. Become root and type the mount command, specifying either the mount point or the block device.

    Specifying the mount point is usually easier. The rest of the information is read from /etc/vfstab.

    # mount mount-point

    The file system is now mounted.

    For instructions showing how to mount different types of file systems using mount with or without options, see System Administration Guide, Volume I.

Changes to the mount Command

Some of the names and forms of the mount commands are different, as listed in Table 9-13.

Table 9-13 mount Command Differences

SunOS release 4 

SunOS release 5.7 



mount -a




umount -a




exportfs -u


showmount -a


showmount -e


See Appendix A, Commands Reference Table, for more information on changes to these commands.

Automatic Mounting of /cdrom and /floppy

In this release, the CD-ROM and diskette file systems are automatically mounted in /cdrom and /floppy when removable media are inserted into these drives. Since these file systems are now managed by the Volume Management daemon, vold(1M), you cannot mount these devices yourself. See "Using Volume Management" for more information.

Specifying File Systems in the /etc/vfstab File

In the SunOS release 5.7 system, you need to list file systems that you want mounted at system startup in your /etc/vfstab, instead of in the /etc/fstab file. The format of /etc/vfstab differs from that of /etc/fstab. For a discussion of the /etc/vfstab file, see "/etc/vfstab File ".

Monitoring File Systems

Table 9-14 shows the file and directory monitoring commands and changes.

Table 9-14 File and Directory Monitoring Commands


Information Provided 

Change (if applicable) 


Size, age, permissions, owner of files 



Total size of directories and their contents 



Disk space occupied by file systems, directories, or mounted resources; used and available disk space 

The SunOS release 4 version of this command provides a different output format containing somewhat different output than the SunOS release 5.7 df command. The SunOS release 5.7 -k option provides output formats similar to those in the SunOS release 4 command. The SunOS release 4 df -t filesystem type reports on files of the specified type, whereas the SunOS release 5.7 df-t command prints full listings with totals.


Number of blocks owned by users 



Names of files meeting search criteria 

The -n cpio-device SunOS release 4 option is not available in the SunOS release 5.7 command.

Write the current file on device in cpio -c format.

Sharing File Systems

File systems were "exported" in the SunOS release 4 software to make them available to other systems. This was done through the /etc/exports file and the exportfs command. However, only NFS systems could be exported.

In the SunOS release 5.7 software, this same concept is referred to as "sharing resources," and it has been expanded to include more file systems. File systems are shared with the share(1M) and shareall(1M) commands. The share command is similar to the exportfs pathname command, while shareall is similar to the exportfs -a command.

The share -F fstype option specifies the type of file system to be shared. If the -F option is not specified, share uses the first file-system type listed in the /etc/dfs/dfstab file.

File systems that you want to be shared automatically should have share command entries in the /etc/dfs/dfstab file (which replaces the /etc/export file). The commands specified in this file are run automatically when the system enters run level 3 (multiuser mode with network file sharing).

Example of /etc/dfs/dfstab File Entries

The following entry gives clients on mercury, venus, and mars read-write access to /export/home1; the second entry gives clients on saturn and jupiter read-only access to /export/news.

share -F nfs -o rw=mercury:venus:mars -d "Home Dir" /export/home1
share -F nfs -o ro=saturn:jupiter -d "News Postings" /export/news

When the system is running in multiuser mode, these file systems are available to the clients listed. The share command displays all resources shared by the local system.

% share
-               /export/home1   rw=mercury:venus:mars   "Home Dir"
-               /export/news    ro=saturn:jupiter   "News Postings"

Creating New File Systems

You define, specify, and create a new file system using either the newfs(1M) or the mkfs(1M) command. The following sections highlight changes in the newfs and mkfs commands.

newfs Command

The SunOS release 5.7 newfs command is a convenient front end to the mkfs command. The newfs command does not support the virtual file-system architecture; it is intended for creating UFS-type file systems only. When you use newfs, it calls and passes arguments to mkfs, which does the real work when creating a ufs file system.

The newfs command accepts only names that conform to the SunOS release 5.7 device naming conventions (see "Device Naming Conventions").

mkfs Command

The SunOS release 5.7 mkfs command differs significantly from the SunOS release 4 version of the command. The SunOS release 5.7 version provides for different file system types, and its command syntax is entirely different (see "Generic File System Commands"). Like newfs, mkfs accepts only names conforming to the SunOS release 5.7 device naming conventions.

Although mkfs now supports different types of file systems, in practice it is almost always used to create ufs file systems. However, mkfs isn't usually run directly; it is usually called by the newfs command.

See mkfs(1) man pages for additional details.

Checking File Systems

The SunOS release 5.7 fsck(1M) command differs significantly from the SunOS release 4 version of the command. In keeping with the virtual file-system (VFS) architecture, the fsck file-checking utility has two parts:

Backing Up and Restoring Files

This section discusses the changes to backup and restore commands and SunOS release 5.7 and describes how to use the ufsdump, ufsrestore, dd, tar, and cpio commands.

The SunOS release 4 software supported several utilities for backing up and restoring files: dump, restore, tar, cpio, dd, and bar, as well as the unbundled Backup CoPilot program. This release supports all of these utilities except bar and Backup Copilot. SunOS release 4 bar files can be restored on a SunOS release 5.7 system but you cannot create new bar files. The dump(8) and restore(8) commands were renamed ufsdump(1M) and ufsrestore(1M). Files created with the SunOS release 4 dump command can be restored on a SunOS release 5.7 system with ufsrestore.

The SunOS release 5.7 software has two additional utilities for copying file systems: volcopy(1M) and labelit(1M).

ufsdump Command

The ufsdump command accepts the same command syntax as the SunOS release 4 dump command. ufsdump also accepts options listed in Table 9-15.

Table 9-15 ufsdump Command Options Not Available With the dump Command




Autoload. When reaching the end of a tape (before completing the dump), take the drive offline and wait up to two minutes for the tape drive to be ready again. This gives autoloading (stackloader) tape drives a chance to load a new tape. If the drive is ready within two minutes, continue. If it is not ready after two minutes, prompt an operator to load another tape and wait. 


Offline. After completing the dump or reaching the end of a tape or diskette, take the drive offline and rewind the tape or eject the diskette. This prevents another process from using the drive and overwriting your data. 


Estimate size of dump. Determine the amount of space that is needed to perform the dump and output a single number indicating the estimated size of the dump in bytes. This is most useful for incremental backups. 

Unlike dump, ufsdump can detect the end of medium, so you no longer have to use the -s size option to force dump programs to move to the next tape before reaching the end. Nevertheless, to ensure compatibility with older versions of the restore command, the -s option has been retained in ufsdump.

Even though ufsdump now can detect the end of medium, it has no way to predict the number of diskettes or tapes needed for a dump--unless you specify the medium size with the -s option. Therefore, the messages displayed at the start of a backup do not indicate the number of diskettes or tapes required unless you have specified the medium size.

The -w and -W options behave a little differently in the SunOS release 5.7 software. In the SunOS release 4 software, these options list all file systems that are scheduled for backup according to the backup frequencies specified in the /etc/fstab file. Since the SunOS release 5.7 equivalent file, /etc/vfstab, has no provision for specifying backup frequencies, these options now assume that each file system will be backed up daily. Therefore, they now list any file systems that have not been backed up within a day.

When performing backups across the network (backing up local file systems to a remote tape drive), use the device naming convention that is appropriate for the system with the tape drive. If the system with the tape drive is a SunOS release 5.7 system, use the device naming convention to identify the tape drive; otherwise, use the SunOS release 4 convention.

ufsrestore Command

The ufsrestore command in the SunOS release 5.7 software is similar to the restore command in the SunOS release 4 software. You will be able to restore backups made with the SunOS release 4 dump command with one exception: you cannot restore multivolume backups from diskette. If you have backup scripts that invoke restore, change them to invoke ufsrestore instead.

dd Command

In the SunOS release 4 version of the dd command, the size suffix -w (words) denotes a size unit of 4 bytes. In the SunOS release 5.7 version, -w denotes a unit of 2 bytes. In addition, the SunOS release 5.7 version now supports the -unblock and -block conversion options.

tar and cpio Commands

Because they use a nonbinary format, the tar and cpio commands are the only utilities to successfully interchange data between SVR4 implementations. Other backup utilities, such as ufsdump and dd, are unique to the vendor and are not guaranteed to work successfully from one SVR4 implementation to another.

The tar command is unchanged in this release; it accepts the same options and command syntax as the SunOS release 4 command. However, since the device naming scheme has changed in the SunOS release 5.7 software, the tarfile (or device) argument is affected. When using the -f function modifier, specify the device argument as /dev/rmt/unit, where unit is a tape drive number and density. Table 9-16 shows the tape drive density characters in tape device names.

Table 9-16 Tape Drive Density Characters in Tape Device Names




Default "preferred" (highest) density 






The tar command no longer uses /dev/rmt8 as its default output device. When the -f modifier is not used and the TAPE environment variable is not set, the tar command uses the defaults set in the /etc/default/tar file.

The SunOS release 5.7 cpio command supports the SunOS release 4 options and command syntax. cpio has been expanded to include many new options, as listed in Table 9-17.

Table 9-17 Additional cpio Options


Command Available With Option 



cpio -o

Appends files to an archive. 


cpio -i

Attempts to skip corrupt file headers and I/O errors encountered. This option lets you copy files from a medium that is corrupted or out of sequence. 


cpio -o or cpio -p

Follows symbolic links. 


cpio -i, cpio -o, or cpio -p

Special verbose. Prints a dot for each file read or written. This option assures you that cpio is working, without printing all file names.

-C bufsize

cpio -i or cpio -o

Blocks I/O bufsize bytes to the record, where bufsize is a positive integer. When neither -C nor -B is specified, the default buffer size is 512 bytes.

-E filename

cpio -i

Specifies and inputs file containing a list of file names to be extracted from the archive. 

-H header

cpio -i or cpio -o

Reads or writes header information in header format. header can be one of:

bar (read only), crc, CRC, odc, tar, TAR, ustar, or USTAR.

-I filename

cpio -i

Reads filename as an input archive.

-M message

cpio -i -I filename or

cpio -o -O filename

Defines a message to use when switching media. 

-O filename

cpio -o

Directs the output to filename.

-R userid

cpio -i or cpio -p

Reassigns ownership and group information for each file to userid.

Note -

cpio requires one of three mutually exclusive options to specify the action to take: -i (copy in), -o (copy out), or -p (pass).