System Administration Guide: Devices and File Systems

ProcedureHow to Create a UFS File System

Steps
  1. Make sure you have met the following prerequisites:

    1. The disk must be formatted and divided into slices.

      For information on formatting disks and dividing disks into slices, see Chapter 10, Managing Disks (Overview).

    2. 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).

    3. If you are re-creating an existing UFS file system, unmount it.

    4. You must be superuser or assume an equivalent role.

  2. Create the UFS file system.


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

    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.

    -b size

    Specifies the block size for the file system, 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. For more information, see newfs(1M).

    device-name

    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 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.


  3. To verify the creation of the UFS file system, check the new file system.


    # fsck /dev/rdsk/device-name
    

    The 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 16–1 Creating a UFS File System

The following example shows how to create 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,
#

See Also

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