System Administration Guide, Volume 1

Creating a UFS File System

Before you can create a UFS file system on a disk, the disk must be formatted and divided into slices. A disk slice is a physical subset of a disk that is composed of a single range of contiguous blocks. A slice can be used either as a raw device that provides, for example, swap space, or to hold a disk-based file system. See Chapter 28, Disk Management (Overview) for complete information on formatting disks and dividing disks into slices.

Logical volume management products, like Solstice DiskSuite, create more sophisticated meta devices, that expand beyond single slice or single disk boundaries. See Solstice DiskSuite 4.2.1 User's Guide for more information about meta devices.

Note -

Solaris device names use the term slice (and the letter s in the device name) to refer to the slice number. Slices are also called "partitions."

You need to create UFS file systems only occasionally, because the Solaris operating environment automatically creates them as part of the installation process. You need to create (or re-create) a UFS file system when you:

The newfs command is the standard way to create UFS file systems. The newfs(1M) command is a convenient front-end to the mkfs(1M) command, which actually creates the new file system. The newfs command reads parameter defaults, such as tracks per cylinder and sectors per track, 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.

File System Parameters

To make a new file system on a disk slice, you almost always use the newfs command. The table below shows the default parameters used by the newfs command.

Table 35-1 Default Parameters Used by the newfs Command


Default Value 

Block size 

8 Kbytes 

Fragment size 

1 Kbyte 

Minimum free space 

((64 Mbytes/partition size) * 100), rounded down to the nearest integer and limited to between 1% and 10%, inclusively 

Rotational delay 


Optimization type 


Number of inodes 

1 for each 2 Kbytes of data space 

How to Create a UFS File System

  1. Make sure you have met the following prerequisites:

    • The disk must be formatted and divided into slices before you can create UFS file systems on it. See Chapter 28, Disk Management (Overview) for complete information on formatting disks and dividing disks into slices.

    • You need to know the device name of the slice that will contain the file system. See Chapter 29, 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.

  2. Create the UFS file system.

    # newfs [-N] [-b size] [-i bytes] /dev/rdsk/device-name


    Displays what parameters newfs would pass to mkfs without actually creating the file system. This is a good way to test the newfs command.

    -b size

    Specifies the file system block size, either 4096 or 8192 bytes per block. The default is 8192. 

    -i bytes

    Specifies the number of bytes per inode. The default varies depending on the disk size. See newfs(1M) for more information.


    Specifies the disk device name on which to create the new file system. 

    The system asks for confirmation.

    Caution - 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. This might cause the system to panic.

  3. To verify the creation of the UFS file system, check the new file system with the fsck(1M) command.

    # fsck /dev/rdsk/device-name


    Specifies the name of the disk device containing the new file system. 

    The fsck command checks the consistency of the new file system, reports problems it finds, and prompts you before repairing the problems. See Chapter 39, Checking File System Integrity for more information on fsck.

Example--Creating a UFS File System

The following example creates a UFS file system on /dev/rdsk/c0t1d0s7.

# newfs /dev/rdsk/c0t1d0s7
/dev/rdsk/c0t1d0s7:  725760 sectors in 720 cylinders of 14 tracks, 72 sectors
        354.4MB in 45 cyl groups (16 c/g, 7.88MB/g, 3776 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 16240, 32448, 48656, 64864, 81072, 97280, 113488, 129696, 145904, 162112,
 178320, 194528, 210736, 226944, 243152, 258080, 274288, 290496, 306704,
 322912, 339120, 355328, 371536, 387744, 403952, 420160, 436368, 452576,
 468784, 484992, 501200, 516128, 532336, 548544, 564752, 580960, 597168,
 613376, 629584, 645792, 662000, 678208, 694416, 710624,

Where to Go From Here

To mount the file system and make it available, go to Chapter 36, Mounting and Unmounting File Systems (Tasks).