|Skip Navigation Links|
|Exit Print View|
|System Administration Guide: Devices and File Systems Oracle Solaris 11 Express 11/10|
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 10, Managing Disks (Overview) for complete information on formatting disks and dividing disks into slices.
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 Oracle Solaris OS automatically creates them as part of the installation process. You need to create (or re-create) a UFS file system when you want to do the following:
Add or replace disks
Change the existing partitioning structure of a disk
Fully restore of a file system
The newfs command is the standard way to create UFS file systems. The newfs command is a convenient front end to the mkfs 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 label for the disk that will contain the new file system. The options you choose are passed to the mkfs command to build the file system.
For information about the default parameters that are used by the newfs command, see newfs(1M).
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).
For more information, see How to Obtain Administrative Rights in System Administration Guide: Security Services.
# newfs [-N] [-b size] [-i bytes] /dev/rdsk/device-name
Displays what parameters the newfs command would pass to the mkfs command without actually creating the file system. This option is a good way to test the newfs command.
Specifies the block size for the file system, either 4096 or 8192 bytes per block. The default is 8192.
Specifies the number of bytes per inode. The default varies depending on the disk size. For more information, see newfs(1M).
Specifies the disk device name on which to create the new file system.
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).
Example 19-1 Creating a UFS File System
The following example shows how to create a UFS file system on /dev/rdsk/c0t1d0s0.
# 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
To mount the UFS file system and make it available, go to Chapter 20, Mounting and Unmounting File Systems (Tasks).