Skip Navigation Links | |
Exit Print View | |
System Administration Guide: Devices and File Systems Oracle Solaris 10 8/11 Information Library |
1. Managing Removable Media (Overview)
2. Managing Removable Media (Tasks)
3. Accessing Removable Media (Tasks)
4. Writing CDs and DVDs (Tasks)
5. Managing Devices (Overview/Tasks)
6. Dynamically Configuring Devices (Tasks)
7. Using USB Devices (Overview)
9. Using InfiniBand Devices (Overview/Tasks)
11. Administering Disks (Tasks)
12. SPARC: Setting Up Disks (Tasks)
13. x86: Setting Up Disks (Tasks)
14. Configuring Oracle Solaris iSCSI Targets and Initiators (Tasks)
15. The format Utility (Reference)
16. Managing File Systems (Overview)
17. 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 UFS File System
How to Create a Multiterabyte UFS File System
How to Expand a Multiterabyte UFS File System
How to Expand a UFS File System to a Multiterabyte UFS File System
Troubleshooting Multiterabyte UFS File System Problems
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 a UFS File System (mount Command)
How to Mount a UFS File System Without Large Files (mount Command)
How to Mount an NFS File System (mount Command)
x86: How to Mount a PCFS (DOS) File System From a Hard Disk (mount Command)
18. Using The CacheFS File System (Tasks)
19. Configuring Additional Swap Space (Tasks)
20. Checking UFS File System Consistency (Tasks)
21. UFS File System (Reference)
22. Backing Up and Restoring UFS File Systems (Overview)
23. Backing Up UFS Files and File Systems (Tasks)
24. Using UFS Snapshots (Tasks)
25. Restoring UFS Files and File Systems (Tasks)
26. UFS Backup and Restore Commands (Reference)
27. Copying Files and File Systems (Tasks)
This section provides examples of creating and mounting Oracle Solaris file systems.
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 re-creating an existing 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 11, Administering Disks (Tasks).
For information on formatting disks and dividing disks into slices, see Chapter 10, Managing Disks (Overview).
# 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 Chapter 20, Checking UFS File System Consistency (Tasks) or fsck(1M).
Example 17-2 Creating and Mounting a 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.
Support for a multiterabyte UFS file system assumes the availability of multiterabyte LUNs, provided as Solaris Volume Manager or VxVM volumes, or as physical disks greater than 1 terabyte.
Before you can create a multiterabyte UFS file system, verify that you have done either of the following:
Created a multiterabyte disk partition by using the format utility or the Solaris installation utilities
Set up a multiterabyte volume with Solaris Volume Manager
For more information about multiterabyte UFS file systems, see Support of Multiterabyte UFS File Systems.
For example, this command creates a UFS file system for a 1.8 terabyte volume:
# newfs /dev/md/rdsk/d99 newfs: construct a new file system /dev/md/rdsk/d99: (y/n)? y /dev/md/rdsk/d99: 3859402752 sectors in 628158 cylinders of 48 tracks, 128 sectors 1884474.0MB in 4393 cyl groups (143 c/g, 429.00MB/g, 448 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 878752, 1757472, 2636192, 3514912, 4393632, 5272352, 6151072, 702... Initializing cylinder groups: ........................................................................ super-block backups for last 10 cylinder groups at: 3850872736, 3851751456, 3852630176, 3853508896, 3854387616, 3855266336, 3856145056, 3857023776, 3857902496, 3858781216
For example:
# fsck /dev/md/rdsk/d99 ** /dev/md/rdsk/d99 ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 2 files, 2 used, 241173122 free (0 frags, 241173122 blocks, 0.0% fragmentation)
For example:
# mount /dev/md/dsk/d99 /bigdir # df -h /bigdir Filesystem size used avail capacity Mounted on /dev/md/dsk/d99 1.8T 64M 1.8T 1% /bigdir
After a multiterabyte UFS file system is created, you can use the growfs command to expand the file system. For example, using the file system that was created for the volume in the preceding procedure, you can add another disk to this volume. Then, expand the file system.
For example:
# metattach d99 c4t5d0s4 d99: component is attached # metastat d99: Concat/Stripe Size: 5145882624 blocks (2.4 TB) Stripe 0: Device Start Block Dbase Reloc c0t1d0s4 36864 Yes Yes Stripe 1: Device Start Block Dbase Reloc c3t7d0s4 0 No Yes Stripe 2: Device Start Block Dbase Reloc c1t1d0s4 0 No Yes Stripe 3: Device Start Block Dbase Reloc c4t5d0s4 0 No Yes
For example:
# growfs -v /dev/md/rdsk/d99 /usr/lib/fs/ufs/mkfs -G /dev/md/rdsk/d99 5145882624 /dev/md/rdsk/d99: 5145882624 sectors in 837546 cylinders of 48 tracks, 128 sectors 2512638.0MB in 5857 cyl groups (143 c/g, 429.00MB/g, 448 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 878752, 1757472, 2636192, 3514912, 4393632, 5272352, 6151072, 702... Initializing cylinder groups: ......................................................................... super-block backups for last 10 cylinder groups at: 5137130400, 5138009120, 5138887840, 5139766560, 5140645280, 5141524000, 5142402720, 5143281440, 5144160160, 5145038880, #
For example:
# mount /dev/md/dsk/d99 /bigdir # df -h /bigdir Filesystem size used avail capacity Mounted on /dev/md/dsk/d99 2.4T 64M 2.4T 1% /bigdir
Use the following procedure to expand a UFS file system to greater than 1 terabyte in size. This procedure assumes that the newfs -T option was used initially to create the UFS file system.
For example, the following volume is 800 gigabytes:
# metastat d98 d98: Concat/Stripe Size: 1677754368 blocks (800 GB) Stripe 0: Device Start Block Dbase Reloc c0t1d0s4 0 No Yes Stripe 1: Device Start Block Dbase Reloc c3t7d0s4 0 No Yes
For example:
# metattach d98 c1t1d0s4 d98: component is attached # metastat d98 d98: Concat/Stripe Size: 2516631552 blocks (1.2 TB) Stripe 0: Device Start Block Dbase Reloc c0t1d0s4 0 No Yes Stripe 1: Device Start Block Dbase Reloc c3t7d0s4 0 No Yes Stripe 2: Device Start Block Dbase Reloc c1t1d0s4 0 No Yes
For example:
growfs -v /dev/md/rdsk/d98 /usr/lib/fs/ufs/mkfs -G /dev/md/rdsk/d98 2516631552 /dev/md/rdsk/d98: 2516631552 sectors in 68268 cylinders of 144 tracks, 256 sectors 1228824.0MB in 2731 cyl groups (25 c/g, 450.00MB/g, 448 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 921888, 1843744, 2765600, 3687456, 4609312, 5531168, 6453024, 737... 8296736, Initializing cylinder groups: ...................................................... super-block backups for last 10 cylinder groups at: 2507714848, 2508636704, 2509558560, 2510480416, 2511402272, 2512324128, 2513245984, 2514167840, 2515089696, 2516011552,
For example:
# mount /dev/md/dsk/d98 /datadir # df -h /datadir Filesystem size used avail capacity Mounted on /dev/md/dsk/d98 1.2T 64M 1.2T 1% /datadir
Use the following error messages and solutions to troubleshoot problems with multiterabyte UFS file systems.
mount: /dev/rdsk/c0t0d0s0 is not this fstype.
You attempted to mount a UFS file system that is greater than 1 terabyte on a system running a Solaris release that does not support this feature.
Mount a UFS file system that is greater than 1 terabyte on a system running a current Solaris release.
"File system was not set up with the multi-terabyte format." "Its size cannot be increased to a terabyte or more."
You attempted to expand a file system that was not created by using the newfs -T command.
Back up the data for the file system that you want to expand to greater than 1 terabyte.
Re-create the file system by using the newfs command to create a multiterabyte file system.
Restore the backup data into the newly created file system.
# 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 17-4.
# mount -v
Example 17-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 17-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 on the /etc/vfstab file, see Field Descriptions for the /etc/vfstab File.
# 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 17-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 17-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.
See Also
For more information on the /etc/vfstab file, see Field Descriptions for 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.
# 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.
For detailed information about the /etc/vfstab field entries, see Table 17-1.
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 17-7 Adding an Entry to the /etc/vfstab File
The following example shows how to mount the disk slice /dev/dsk/c0t3d0s7 as a 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
The following example shows how to mount the root (/) file system on a loopback mount point, /tmp/newroot. LOFS file systems must always be mounted after the file systems that are in the LOFS file system.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # / - /tmp/newroot lofs - yes -
# 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 17-8 Mounting a File System (/etc/vfstab File)
The following example shows how to mount the /legacy file system that is listed in the /etc/vfstab file.
# mount /legacy
Example 17-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
# 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 [-o mount-options] /dev/dsk/device-name /mount-point
Example 17-10 Mounting a UFS File System (mount Command)
The following example shows how to mount /dev/dsk/c0t3d0s7 on the /files1 directory.
# mount /dev/dsk/c0t3d0s7 /files1
When you mount a file system, the largefiles option is selected by default. This option enables you to create files larger than 2 GB. If a file system contains large files, you cannot remount the file system with the nolargefiles option or mount it on a system that is running older Solaris versions, until you remove any large files and run the fsck command to reset the state to nolargefiles.
This procedure assumes that the file system is in the /etc/vfstab file.
# 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.
# cd /mount-point # find . -xdev -size +20000000 -exec ls -l {} \;
where /mount-point identifies the mount point of the file system you want to check for large files.
# umount /mount-point
# fsck /mount-point
# mount -o nolargefiles /mount-point
Example 17-11 Mounting a UFS File System Without Large Files (mount Command)
The following example shows how to check the /datab file system and remount it with the nolargefiles option.
# cd /datab # find . -xdev -size +20000000 -exec ls -l {} \; # umount /datab # fsck /datab # mount -o nolargefiles /datab
# 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 System Administration Guide: Network Services.
# mount -F nfs [-o mount-options] server:/directory /mount-point
Example 17-12 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.
# 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 17-13 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
# 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 17-14 Stopping All Processes 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 UFS file system, except for the root (/), /usr, or /var file systems.
Note - The root (/), /usr, and /var file systems can be unmounted only during a shutdown. The system needs these file systems to function.
# 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 17-15 Unmounting a File System
The following example shows how to unmount a legacy UFS file system.
# umount /legacy
The following example shows how to unmount the UFS file system on slice 7.
# umount /dev/dsk/c0t0d0s7
The following example shows how to forcibly unmount the UFS /legacy file system.
# umount -f /legacy #
The following example shows how to unmount all UFS file systems in the /etc/vfstab file, except for the root (/), /proc, /var, and /usr file systems.
# umountall
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.