JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Devices and File Systems     Oracle Solaris 10 1/13 Information Library
search filter icon
search icon

Document Information

Preface

1.  Managing Removable Media (Overview/Tasks)

2.  Writing CDs and DVDs (Tasks)

3.  Managing Devices (Tasks)

4.  Dynamically Configuring Devices (Tasks)

5.  Managing USB Devices (Tasks)

6.  Using InfiniBand Devices (Overview/Tasks)

7.  Managing Disks (Overview)

8.  Managing Disk Use (Tasks)

9.  Administering Disks (Tasks)

10.  SPARC: Setting Up Disks (Tasks)

11.  x86: Setting Up Disks (Tasks)

12.  Configuring Oracle Solaris iSCSI Targets (Tasks)

13.  The format Utility (Reference)

14.  Managing File Systems (Overview)

15.  Creating and Mounting File Systems (Tasks)

Creating Oracle Solaris File Systems

Creating ZFS File Systems

Creating a Temporary File System

Creating a LOFS File System

Mounting and Unmounting Oracle Solaris File Systems

Field Descriptions for the /etc/vfstab File

Prerequisites for Unmounting Oracle Solaris File Systems

Creating and Mounting Oracle Solaris File Systems

How to Create an ZFS File System

How to Create and Mount a Legacy UFS File System

How to Create and Mount a TMPFS File System

How to Create and Mount an LOFS File System

How to Add an Entry to the /etc/vfstab File

How to Mount a File System (/etc/vfstab File)

How to Mount an NFS File System (mount Command)

x86: How to Mount a PCFS (DOS) File System From a Hard Disk (mount Command)

How to Stop All Processes That Are Accessing a File System

How to Unmount a File System

16.  Configuring Additional Swap Space (Tasks)

17.  Checking UFS File System Consistency (Tasks)

18.  UFS File System (Reference)

19.  Backing Up and Restoring UFS File Systems (Overview/Tasks)

20.  Using UFS Snapshots (Tasks)

21.  Copying Files and File Systems (Tasks)

22.  Managing Tape Drives (Tasks)

23.  UFS Backup and Restore Commands (Reference)

Index

Creating and Mounting Oracle Solaris File Systems

This section provides examples of creating and mounting Oracle Solaris file systems.

How to Create an ZFS File System

  1. Become superuser.
  2. Create a ZFS storage pool.

    The following example illustrates how to create a simple mirrored storage pool named tank and a ZFS file system named tank in one command. Assume that the whole disks /dev/dsk/c1t0d0 and /dev/dsk/c2t0d0 are available for use.

    # zpool create tank mirror c1t0d0 c2t0d0
  3. Create a ZFS file system.
    # zfs create tank/fs

    The new ZFS file system, tank/fs, can use as much of the disk space as needed, and is automatically mounted at /tank/fs.

  4. Confirm that the file system is created.
    # zfs list -r tank
    NAME      USED  AVAIL  REFER  MOUNTPOINT
    tank      117K   268G    21K  /tank
    tank/fs    21K   268G    21K  /tank/fs

How to Create and Mount a Legacy UFS File System

Before You Begin

Ensure that you have met the following prerequisites:

For information on finding disks and disk slice numbers, see Chapter 9, Administering Disks (Tasks).

For information on formatting disks and dividing disks into slices, see Chapter 7, Managing Disks (Overview).

  1. Become superuser.
  2. Create a legacy UFS file system.
    # newfs [-N] [-b size] [-i bytes] /dev/rdsk/device-name

    The system asks for confirmation.


    Caution

    Caution - Be sure you have specified the correct device name for the slice before performing this step. If you specify the wrong slice, you will erase its contents when the new file system is created. This error might cause the system to panic.


  3. To verify the creation of the legacy UFS file system, check the new file system.
    # fsck /dev/rdsk/device-name

    where device-name argument specifies the name of the disk device that contains the new file system.

    The fsck command checks the consistency of the new file system, reports any problems, and prompts you before it repairs the problems. For more information on the fsck command, see fsck(1M).

  4. Mount the legacy UFS file system.
    # mkdir /directory-name
    # mount /dev/dsk/device-name /directory-name

Example 15-2 Creating and Mounting a Legacy UFS File System

The following example shows how to create and mount a UFS file system /dev/rdsk/c0t1d0s0 on /legacy.

# newfs /dev/rdsk/c0t1d0s0
newfs: construct a new file system /dev/rdsk/c0t1d0s0: (y/n)? y
/dev/rdsk/c0t1d0s0:     286722656 sectors in 46668 cylinders of 48 tracks, 128 sectors
        140001.3MB in 2917 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
..........................................................
super-block backups for last 10 cylinder groups at:
 285773216, 285871648, 285970080, 286068512, 286166944, 286265376, 286363808,
 286462240, 286560672, 286659104
# fsck /dev/rdsk/c0t1d0s0
# mkdir /legacy
# mount /dev/dsk/c0t1d0s0 /legacy
After You Create a Legacy UFS File System ...

To mount the legacy UFS file system automatically at boot time, go to How to Add an Entry to the /etc/vfstab File.

How to Create and Mount a TMPFS File System

  1. Become superuser.
  2. Create the directory that you want to mount as the TMPFS file system, if necessary.
    # mkdir /mount-point

    where mount-point is the directory on which the TMPFS file system is mounted.

  3. Mount the TMPFS file system.
    # mount -F tmpfs [-o size=number]  swap mount-point
    -o size=number

    Specifies the size limit of the TMPFS file system in MB.

    mount-point

    Specifies the directory on which the TMPFS file system is mounted.

    To set up the system to automatically mount a TMPFS file system at boot time, see Example 15-4.

  4. Verify that the TMPFS file system has been created.
    # mount -v

Example 15-3 Creating and Mounting a TMPFS File System

The following example shows how to create, mount, and limit the size of the TMPFS file system, /export/reports, to 50 MB.

# mkdir /export/reports
# chmod 777 /export/reports
# mount -F tmpfs -o size=50m swap /export/reports
# mount -v

Example 15-4 Mounting a TMPFS File System at Boot Time

You can set up the system to automatically mount a TMPFS file system at boot time by adding an /etc/vfstab entry. The following example shows an entry in the /etc/vfstab file that mounts /export/test as a TMPFS file system at boot time. Because the size=number option is not specified, the size of the TMPFS file system on /export/test is limited only by the available system resources.

swap - /export/test  tmpfs   -  yes  -

How to Create and Mount an LOFS File System

  1. Become superuser.
  2. Create the directory you want to mount as an LOFS file system, if necessary.
    # mkdir loopback-directory
  3. Grant the appropriate permissions and ownership on the newly created directory.
  4. Create the mount point where you want to mount the LOFS file system, if necessary.
    # mkdir /mount-point
  5. Mount the LOFS file system.
    # mount -F lofs loopback-directory /mount-point
    loopback-directory

    Specifies the file system to be mounted on the loopback mount point.

    /mount-point

    Specifies the directory on which to mount the LOFS file system.

  6. Verify that the LOFS file system has been mounted.
    # mount -v

Example 15-5 Creating and Mounting an LOFS File System

The following example shows how to create, mount, and test new software in the /new/dist directory as a loopback file system without actually having to install it.

# mkdir /tmp/newroot
# mount -F lofs /new/dist /tmp/newroot
# chroot /tmp/newroot newcommand

Example 15-6 Mounting an LOFS File System at Boot Time

You can set up the system to automatically mount an LOFS file system at boot time by adding an entry to the end of the /etc/vfstab file. The following example shows an entry in the /etc/vfstab file that mounts an LOFS file system for the root (/) file system on /tmp/newroot.

/ - /tmp/newroot  lofs   -  yes  -

Ensure that the loopback entries are the last entries in the /etc/vfstab file. Otherwise, if the /etc/vfstab entry for a loopback file system precedes the file systems to be included in it, the loopback file system cannot be mounted.

How to Add an Entry to the /etc/vfstab File

Use this procedure to mount non-ZFS file systems at boot time unless legacy mount behavior is needed for some ZFS file systems. For more information about mounting ZFS file systems, see Oracle Solaris ZFS Administration Guide.

  1. Become superuser.
  2. Create a mount point for the file system to be mounted, if necessary.
    # mkdir /mount-point

    There must be a mount point on the local system to mount a file system. A mount point is a directory to which the mounted file system is attached.

  3. Edit the /etc/vfstab file and add an entry. Ensure that you do the following:
    1. Separate each field with white space (a space or a tab).
    2. Specify a dash (-) if a field has no contents.
    3. Save the changes.

    Note - Because the root (/) file system is mounted read-only by the kernel during the boot process, only the remount option (and options that can be used in conjunction with remount) affect the root (/) entry in the /etc/vfstab file.


Example 15-7 Adding an Entry to the /etc/vfstab File

The following example shows how to mount the disk slice /dev/dsk/c0t3d0s7 as a legacy UFS file system to the mount point /files1. The raw character device /dev/rdsk/c0t3d0s7 is specified as the device to fsck. The fsck pass value of 2 means that the file system will be checked, but not sequentially.

#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
#
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /files1  ufs      2      yes       -

The following example shows how to mount the /export/man directory from the system pluto as an NFS file system on mount point /usr/man. Neither a device to fsck nor a fsck pass is specified because it's an NFS file system. In this example, mount options are ro (read-only) and soft.

#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
pluto:/export/man   -                /usr/man nfs      -      yes       ro,soft

How to Mount a File System (/etc/vfstab File)

  1. Become superuser.
  2. Mount a file system listed in the /etc/vfstab file.
    # mount /mount-point

    where /mount-point specifies an entry in the mount point or device to mount field in the /etc/vfstab file. It is usually easier to specify the mount point.

Example 15-8 Mounting a File System (/etc/vfstab File)

The following example shows how to mount the local /legacy file system that is listed in the /etc/vfstab file.

# mount /legacy

Example 15-9 Mounting All File Systems (/etc/vfstab File)

The following example shows the messages that are displayed when you use the mountall command and the file systems are already mounted.

# mountall
mount: /tmp is already mounted or swap is busy

The following example shows how to mount all the local systems that are listed in the /etc/vfstab file.

# mountall -l

The following example shows how to mount all available ZFS file systems.

# zfs mount -a

The following example shows how to mount all the remote file systems that are listed in the /etc/vfstab file.

# mountall -r

How to Mount an NFS File System (mount Command)

  1. Become superuser.
  2. Create a mount point for the file system to be mounted, if necessary.
    # mkdir /mount-point

    There must be a mount point on the local system to mount a file system. A mount point is a directory to which the mounted file system is attached.

  3. Ensure that the resource (file or directory) is available from a server.

    To mount an NFS file system, the resource must be made available on the server by using the share command. For information on how to share resources, see About the NFS Service in System Administration Guide: Network Services.

  4. Mount the NFS file system.
    # mount -F nfs [-o mount-options] server:/directory /mount-point

Example 15-10 Mounting an NFS File System (mount Command)

The following example shows how to mount the /export/packages directory on /mnt from the server pluto.

# mount -F nfs pluto:/export/packages /mnt

x86: How to Mount a PCFS (DOS) File System From a Hard Disk (mount Command)

Use the following procedure to mount a PCFS (DOS) file system from a hard disk.

  1. Become superuser.
  2. Create a mount point for the file system to be mounted, if necessary.
    # mkdir /mount-point

    There must be a mount point on the local system to mount a file system. A mount point is a directory to which the mounted file system is attached.

  3. Mount the PCFS file system.
    # mount -F pcfs [-o rw | ro] /dev/dsk/device-name:logical-drive /mount-point
    -o rw | ro

    Specifies that you can mount a PCFS file system read/write (rw) or read-only (ro). If you do not specify this option, the default is rw.

    /dev/dsk/device-name

    Specifies the device name of the whole disk (for example, /dev/dsk/c0t0d0p0).

    logical-drive

    Specifies either the DOS logical drive letter (c through z) or a drive number (1 through 24). Drive c is equivalent to drive 1 and represents the primary DOS slice on the drive. All other letters or numbers represent DOS logical drives within the extended DOS slice.

    /mount-point

    Specifies the directory on which to mount the file system.

    Note that the device-name and logical-drive must be separated by a colon.

Example 15-11 x86: Mounting a PCFS (DOS) File System From a Hard Disk (mount Command)

The following example shows how to mount the logical drive in the primary DOS slice on the /pcfs/c directory.

# mount -F pcfs /dev/dsk/c0t0d0p0:c /pcfs/c

The following example shows how to mount read-only the first logical drive in the extended DOS slice on the /mnt directory.

# mount -F pcfs -o ro /dev/dsk/c0t0d0p0:2 /mnt

How to Stop All Processes That Are Accessing a File System

  1. Become superuser.
  2. List all the processes that are accessing the file system so that you know which processes you are going to stop.
    # fuser -c [ -u ] /mount-point
    -c

    Reports on files that are mount points for file systems and any files within those mounted file systems.

    -u

    Displays the user login name for each process ID.

    /mount-point

    Specifies the name of the file system for which you want to stop processes.

  3. Stop all processes that are accessing the file system.
    # fuser -c -k /mount-point

    A SIGKILL is sent to each process that is using the file system.


    Note - You should not stop a user's processes without first warning the user.


  4. Verify that no processes are accessing the file system.
    # fuser -c /mount-point

Example 15-12 Stopping All Processes That Are Accessing a File System

The following example shows how to stop process 4006c that is using the /export/home file system.

# fuser -c /export/home
/export/home:     4006c
# fuser -c -k /export/home
/export/home:     4006c
# fuser -c /export/home
/export/home: 

How to Unmount a File System

Use the following procedure to unmount a file system.

  1. Ensure that you have met the prerequisites listed in Prerequisites for Unmounting Oracle Solaris File Systems.
  2. Unmount the file system.
    # umount /mount-point

    where /mount-point is the name of the file system that you want to unmount.

    This can be one of the following:

    • The directory name where the file system is mounted

    • The device name path of the file system

    • The resource for an NFS file system

    • The loopback directory for an LOFS file system

Example 15-13 Unmounting a File System

The following example shows how to unmount a legacy UFS file system:

# umount /legacy

The following example shows how to forcibly unmount the UFS /legacy file system:

# umount -f /legacy
# 

The following example shows to unmount all ZFS file systems:

# zfs umount -a

All file systems are unmounted, except for those file systems that are busy.