[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3

mkfs Command

Purpose

Makes a file system.

Syntax

mkfs [ -b Boot ] [ -l Label ] [ -i i-Nodes ] [ -o Options ] [ -p Prototype ] [ -s Size ] [ -v VolumeLabel ] [ -V VfsName ] Device

Description

The mkfs command makes a new file system on a specified device. The mkfs command initializes the volume label, file system label, and startup block.

The Device parameter specifies a block device name, raw device name, or file system name. If the parameter specifies a file system name, the mkfs command uses this name to obtain the following parameters from the applicable stanza in the /etc/filesystems file, unless these parameters are entered with the mkfs command:

dev Device name
vol Volume ID
size File system size
boot Program to be installed in the startup block
vfs Definition of the virtual file system
options File-system implementation-specific options of the form Keyword, Keyword=Value
Notes:
  1. The file system is created with the setgid (set group ID) bit enabled. The setgid bit determines the default group permissions. All directories created under the new file system have the same default group permissions.
  2. The mkfs command does not alter anything in a mounted file system, including the file system label. The file system label changes when you change the mount point, unless the file system is mounted.

Flags

-b Boot Names the program to be installed in block 0 of the new file system.
-i i-Nodes Specifies the initial number of i-nodes on the file system. This flag is ignored when creating a journaled file system.
-l Label Specifies the file system label for the new file system.
-o Options Specifies a comma-separated list of virtual file system implementation-specific options.

The following options are specific to the Journaled File System (JFS):

-o ag={ 8 | 16 | 32 | 64 } Specifies the allocation group size in megabytes. An allocation group is a grouping of inodes and disk blocks similar to BSD cylinder groups. The default ag value is 8.
-o bf={ true | false } Specifies a large file enabled file system. See "Understanding Large File Enabled File Systems" for more information. If you do not need a large file enabled file system, set this option to false; this is the default. Specifying bf=true requires a fragment size of 4096 and compress=no.
-o frag={ 512 | 1024 | 2048 | 4096 } Specifies the JFS fragment size in bytes. A file system fragment is the smallest unit of disk storage that can be allocated to a file. The default fragment size is 4096 bytes.
-o compress={ no | LZ } Specifies data compression. If you do not want data to be compressed, set this option to no. Selecting compression requires a fragment size of 2048 or less.
-o nbpi={ 512 | 1024 | 2048 | 4096 |8192 | 16384 | 32768 | 65536 | 131072 } Specifies the number of bytes per i-node (nbpi). The nbpi is the ratio of file system size in bytes to the total number of i-nodes. The default nbpi value is 4096 bytes. The values 32768, 65536, and 131072 only apply to AIX 4.2 or later.
Notes:
  1. File systems created with an ag value greater than 8 is not recognized on an AIX 4.1 system.
  2. The ag, bf, compress, frag, and nbpi attributes are set at file system creation and cannot be changed after the file system is successfully created. The size attribute defines the minimum file system size, and you cannot decrease it after the file system is created.
  3. The root filesystem ( / ) cannot be compressed.
  4. Some nbpi values and allocation group sizes are mutually exclusive. See "Understanding JFS Size Limitations" for information.

The following options are specific to the Enhanced Journaled File System (JFS2):

-o agblksize={ 512 | 1024 | 2048 | 4096 } Specifies the JFS2 block size in bytes. A file system block is the smallest unit of disk storage that can be allocated to a file. The default block size is 4096 bytes.
-o dense Specifies when files are created with holes JFS2 will allocate disk blocks for those holes and fill them with 0's.
-o name=mountpoint Specifies the mount point for the file system.

Specifies the log logical volume name. The specified logical volume is the logging device for the new JFS2.

-o log=INLINE

Specifies to place the log in the logical volume with the JFS2 file system. The INLINE log will default to .4% of the logical volume size if logsize is not specified.

-o logsize=Value Specifies the size for an INLINE log in MBytes. Ignored if INLINE log not being used. Cannot be greater than 10% of the size of the filesystem.
Note
The agblksize and dense attributes are set at file system creation and cannot be changed after the file system is successfully created. The size attribute defines the minimum file system size, and you cannot decrease it after the file system is created.
-p Prototype Specifies the name of the prototype file. Options specified on the command line override attributes in the prototype file.
-s Size Specifies the size of the file system. Size can be specified in units of 512-byte blocks, Megabytes (suffix M should be used) or Gigabytes (suffix G should be used). See "Understanding JFS Size Limitations" for more information.
Notes:
  1. The volume group in which the file system resides defines a maximum logical volume size and also limits the file system size.
  2. The -s Size flag specifies the minimum file size and cannot be decreased after the file system has been successfully created.
-v VolumeLabel Specifies the volume label for the new file system.
-V VfsName Specifies the virtual file system (VFS) type. The VFS must have an entry in the /etc/vfs file.

Examples

  1. To specify the volume and file system name for a new file system, type:
    mkfs  -lworks  -vvol001 /dev/hd3
    This command creates an empty file system on the /dev/hd3 device, giving it the volume serial number vol001 and file system name works. The new file system occupies the entire device. The file system has a default fragment size (4096 bytes) and a default nbpi ratio (4096).
  2. To create a file system with nondefault attributes, type:
    mkfs  -s 8192  -o nbpi=2048,frag=512 /dev/lv01
    This command creates an empty 4MB file system on the /dev/lv01 device with 512-byte fragments and 1 i-node for each 2048 bytes.
  3. To create a large file enabled file system, type:

    mkfs -V jfs -o nbpi=131072,bf=true,ag=64 /dev/lv01

    This creates a large file enabled JFS file system with an allocation group size of 64 megabytes and 1 inode for every 131072 bytes of disk. The size of the file system will be the size of the logical volume lv01.

  4. To create a file system with nondefault attributes, type:
    mkfs -s 4M -o nbpi=2048, frag=512 /dev/lv01
    
    This command creates an empty 4MB file system on the /dev/lv01 device with 512-byte fragments and one i-node for each 2048 bytes.

Files

/etc/vfs Contains descriptions of virtual file system types.
/etc/filesystems Lists the known file systems and defines their characteristics.

Related Information

The fsck command, mkproto command, proto command.

The ioctl subroutine.

The dir file, filesystems file, filsys.h file.

File Systems in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices.

Understanding JFS Size Limitations in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]