Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Administration: Devices and File Systems Oracle Solaris 11.1 Information Library |
1. Managing Removable Media (Tasks)
2. Writing CDs and DVDs (Tasks)
4. Dynamically Configuring Devices (Tasks)
5. Managing USB Devices (Tasks)
6. Using InfiniBand Devices (Overview/Tasks)
9. Administering Disks (Tasks)
11. Configuring Storage Devices With COMSTAR (Tasks)
12. Configuring and Managing the Oracle Solaris Internet Storage Name Service (iSNS)
13. The format Utility (Reference)
14. Managing File Systems (Overview)
15. Creating and Mounting File Systems (Tasks)
Creating Oracle Solaris File Systems
Creating a Temporary 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)
16. Configuring Additional Swap Space (Tasks)
17. Copying Files and File Systems (Tasks)
This section provides examples of creating and mounting Oracle Solaris file systems.
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
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
# 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.
# zfs list -r tank NAME USED AVAIL REFER MOUNTPOINT tank 117K 268G 21K /tank tank/fs 21K 268G 21K /tank/fs
Before You Begin
Ensure that you have met the following prerequisites:
The disk must be formatted and divided into slices.
If you are recreating an existing legacy UFS file system, unmount it.
You need to know the device name of the slice that will contain the file system.
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).
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# newfs [-N] [-b size] [-i bytes] /dev/rdsk/device-name
The system asks for confirmation.
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. |
# 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).
# 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
To mount the legacy UFS file system automatically at boot time, go to How to Add an Entry to the /etc/vfstab File.
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# mkdir /mount-point
where mount-point is the directory on which the TMPFS file system is mounted.
# mount -F tmpfs [-o size=number] swap mount-point
Specifies the size limit of the TMPFS file system in MB.
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.
# 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 -
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# mkdir loopback-directory
# mkdir /mount-point
# mount -F lofs loopback-directory /mount-point
Specifies the file system to be mounted on the loopback mount point.
Specifies the directory on which to mount the LOFS file system.
# 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.
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 11.1 Administration: ZFS File Systems.
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# 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.
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
After you add the remote system and resource to the /etc/vfstab file, be sure that the following service is started.
# svcs -a | grep nfs/client disabled May_14 svc:/network/nfs/client:default # svcadm enable svc:/network/nfs/client:default
Otherwise, the remote file system will not be mounted after the system is rebooted.
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# 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
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# 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.
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 Oracle Solaris Administration: Network Services.
# 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
Use the following procedure to mount a PCFS (DOS) file system from a hard disk.
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# 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.
# mount -F pcfs [-o rw | ro] /dev/dsk/device-name:logical-drive /mount-point
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.
Specifies the device name of the whole disk (for example, /dev/dsk/c0t0d0p0).
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.
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
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# fuser -c [ -u ] /mount-point
Reports on files that are mount points for file systems and any files within those mounted file systems.
Displays the user login name for each process ID.
Specifies the name of the file system for which you want to stop processes.
# 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.
# 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:
Use the following procedure to unmount a 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.