System Administration Guide, Volume I

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

  2. Create the UFS file system.


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

    -N

    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. Default is 8192 blocks. 

    -i bytes

    Specifies the number of bytes per inode. Default is 2048 bytes. 

    device-name

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


    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.


    The system asks for confirmation.

  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
    

    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 31, 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/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,

Where to Go From Here

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