You need to create UFS file systems only occasionally, because 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 existing partitioning structure
Do a full restoration on a file system
The following procedure uses the newfs command to create UFS file systems. The newfs command is a convenient front-end to the mkfs command, which creates the new file system. On Solaris 2.x systems, newfs parameter defaults, such as tracks per cylinder and sectors per track, are read from the disk label that will contain the new file system, and the options you choose are passed to the mkfs command to build the file system.
To make a new file system on a disk slice, you almost always use the newfs command. Table 27-1 shows the default parameters the newfs command uses.
Table 27-1 Default Parameters Used by the newfs Command
Parameter |
Default Value |
---|---|
Block size |
8 Kbytes |
Fragment size |
1 Kbyte |
Minimum free space |
10% |
Rotational delay |
Device-dependent |
Optimization type |
Space |
Number of inodes |
1 for each 2 Kbytes of disk space |
The disk must be formatted and divided into slices before you can create UFS file systems on it.
You need to know the raw device file name of the slice that will contain the file system. See Chapter 22, Administering Disks (Tasks) for information on finding disks and disk slice numbers.
If you are re-creating an existing UFS file system, unmount it.
You must be superuser.
Make sure you have met the prerequisites listed on "Prerequisites".
Create the file system.
# newfs [-N] [-b size] [-i bytes] /dev/rdsk/device-name |
-N |
Displays all of the parameters newfs would pass to mkfs. No file system is created. |
-b size |
Sets the file system block size. Default is 8192 blocks. |
-i bytes |
Sets the number of bytes per inode. Default is 2048 bytes. |
device-name |
The device that will contain the new file system. |
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.
The system asks for confirmation.
To verify the creation of UFS file systems, check the new file systems with the fsck command.
# fsck /dev/rdsk/device-name |
device-name |
The name of the device containing the new file system. |
This utility checks the consistency of the new file system, reports problems it finds, and prompts you before repairing the problems. See Chapter 31, Checking File System Integrity for more information on fsck.
This example creates a file system on /dev/rdsk/c0t3d0s7.
# 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, |
If You Want to Make the File System Available By ... |
Then ... |
---|---|
Mounting the file system with the mount command | |
Creating an entry in /etc/vfstab to make the system automatically mount the file system when it boots |