Contenues dans
Trouver plus de documentation
Ressources d'assistance comprises
| Télécharger cet ouvrage au format PDF
Creating File Systems
2
- This chapter contains these sections:
-
Creating a UFS File System on a Disk Slice
- You need to create UFS file systems only occasionally. The system software automatically creates file systems as part of the installation process. You need to create (or re-create) a UFS file system when you:
-
- Add or replace disks
- Change the slices of an existing disk
- Do a full restore on a file system
- Change some parameters (such as block size) of a file system
- Use the newfs command to create UFS file systems. newfs is a convenient front-end to the mkfs command, the program that creates the new file system. On Solaris 2.x systems, information used to set some parameter defaults, such as number of tracks per cylinder and number of sectors per track, is read from the disk label. newfs determines the file system parameters to use based on the options you choose and information from the disk label, and passes the parameters to the mkfs command, which builds the file system.
- Although you can use the mkfs command directly, you need to know much more about the parameters and how to choose them. mkfs supplies defaults for all parameters, but they are not tuned to the underlying hardware. You must also specify the total size of the slice.
- Use the mkfs command:
-
- To create a disk-based file system type other than UFS, if the software for such a file system type is available.
- To create a UFS file system whose logical geometry differs from the physical geometry of the disk. For example, you could specify parameters appropriate for a diskette.
- See Appendix A, "File System Reference," for information about choosing parameters and using the mkfs command.
Preparing to Create a UFS File System
- To create a file system on a formatted disk that has been divided into slices, you need to know the special device file name of the slice that will contain the file system. See the Administration Supplement for Solaris Platforms for a description of disk device naming conventions. See "How to Get Information About Disks and Disk Slices" on page 15 for information on finding disks and disk slice numbers.
· How to Create a UFS File System
- The disk must be formatted and divided into slices before you can create UFS file systems on it. If you are re-creating an existing UFS file system, unmount the file system before performing these steps:
-
-
Become superuser.
-
Type newfs /dev/rdsk/device-name and press Return. You are asked if you want to proceed.
-
Caution - Be sure you have specified the correct device name for the slice before performing the next step. If you specify the wrong slice, you will erase its contents when the new file system is created.
-
-
Type y to confirm.
The newfs command uses optimized default values to create the file system.
-
Example: How to Create a UFS File System This example creates a file system on /dev/rdsk/c0t3d0s7:
-
jupiter% su
Password:
# newfs /dev/rdsk/c0t3d0s7
newfs: construct a new file system /dev/rdsk/c0t3d0s7 (y/n)? y
/dev/rdsk/c0t3d0s7: 163944 sectors in 506 cylinders of 9 tracks, 36 sectors
83.9MB in 32 cyl groups (16 c/g, 2.65MB/g, 1216 i/g)
super-block backups (for fsck -b #) at:
32, 5264, 10496, 15728, 20960, 26192, 31424, 36656, 41888,
47120, 52352, 57584, 62816, 68048, 73280, 78512, 82976, 88208,
93440, 98672, 103904, 109136, 114368, 119600, 124832, 130064, 135296,
140528, 145760, 150992, 156224, 161456,
#
|
Installing a Boot Block on a UFS File System
- See the Administration Supplement for Solaris Platforms for information on installing a boot block on a UFS file system.
Creating a Temporary File System (TMPFS)
- By default, the /tmp directory for the SunOS system software is a TMPFS file system, and an entry is provided for it in the default /etc/vfstab file.
- The most common use for the TMPFS file system is for the /tmp directory, although you may find other ways to use it. If you do create multiple TMPFS file systems, be aware that they all use the same system resources. Files created under one TMPFS directory use up the space available for any other TMPFS file system.
- Because files in TMPFS directories do not survive across reboots or unmounts, do not mount TMPFS file systems under /var/tmp. The vi -r command expects to find preserved files in the /var/tmp directory after a system is rebooted.
- You can put a size limit on a temporary file system using the -o size option of mount. See the tmpfs(7) manual page for more information. See Chapter 1, "Planning File Systems," for a description of TMPFS.
· How to Create a Temporary File System
- To create a temporary file system from a command line:
-
-
Become superuser.
-
If necessary, create the directory where you want to mount the TMPFS file system and give it the appropriate permissions and ownership.
-
Type mount -F tmp swap directory-name and press Return. The temporary file system is created and mounted on the mount point you specify.
- To create an entry for the TMPFS file system in the /etc/vfstab file, add an entry like this, separating each field with a Tab:
-
swap - directory tmp - yes -
|
Creating a Loopback File System
- See Chapter 1, "Planning File Systems," for a description of loopback file systems.
-
Caution - Be careful when creating loopback mounts. The potential for confusing both users and applications is enormous. Make sure the loopback entry follows the entries for all other file systems to be included. To be safe, make it the last entry in the /etc/vfstab file. If the /etc/vfstab entry for the loopback file system precedes the file systems to be included in it, the loopback file system cannot be created.
· How to Create a Loopback File System
-
-
Become superuser.
-
Type mkdir mount-point and press Return.
-
Type mount -F lofs lo-directory mount-point. lo-directory specifies the part of the file system to be mounted at the loopback mount point.
- If this is to be a permanent loopback file system, you can create an entry in the /etc/vfstab file for the loopback file system. Entries for loopback file systems must follow the entries for the file systems to be mounted on the loopback mount point. This example mounts the entire file system hierarchy under the mount point directory /tmp/newroot:
-
#device device mount FS fsck auto- mount
#to mount to fsck point type pass mount? options
/ - /tmp/newroot lofs - yes -
|
- This example shows how to use a loopback file system in conjunction with chroot to provide a complete virtual file system view to a process or family of processes:
-
# mount -F lofs / /tmp/newroot
# chroot /tmp/newroot command
|
|
|