Makes a file system.
mkfs [ -b Boot ] [ -l Label ] [ -i i-Nodes ] [ -o Options ] [ -p Prototype ] [ -s Size ] [ -v VolumeLabel ] [ -V VfsName ] Device
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:
Item | Description |
---|---|
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 |
Item | Description |
---|---|
-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):
Item | Description |
---|---|
-o ag={ 8 | 16 | 32 | 64 } | Specifies the allocation group size in megabytes. An allocation group is a grouping of i-nodes 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 JFS and large files 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. |
The following options are specific to the Enhanced Journaled File System:
Item | Description |
---|---|
-o agblksize={ 512 | 1024 | 2048 | 4096 } | Specifies the Enhanced Journaled File System (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 isnapshot={yes|no} | Specifies whether the file system can support internal snapshots. Specifying yes enables the file system to support internal snapshots and v2 extended attributes. The resulting file system is not compatible with releases earlier than AIX 6.1. |
-o name=mountpoint | Specifies the mount point for the file system. |
-o log=LVName | 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 2047 MBytes and cannot be greater than 10% of the size of the file system. |
-o ea={v1 | v2} | Specifies the format to be used to store named extended attributes in the JFS2 file system. The v2 format provides support for scalable named extended attributes as well as support for NFS4 ACLs. The v1 format is compatible with prior releases of AIX. The default format is v1. |
-o efs={yes|no} | Specifies encryption. Specifying yes enables encryption for the JFS2 file system.
|
-o vix={yes|no} | Specifies whether the file system can allocate
i-node extents smaller than the default of 16 KB, if there are no
contiguous 16 KB extents free in the file system. After a file system
is enabled for small free extents, the file system cannot be accessed
on AIX 5.1 or earlier
releases.
|
-o maxext=Value | Specifies the maximum size of a file extent in file system blocks. A zero value implies that the JFS2 default maximum should be used. Values less than 0 or exceeding maximum supported extent size of 16777215 are invalid. |
The ea attribute format is set at file system creation. The chfs command can be used to convert the extended attribute format from v1 to v2, but the format cannot be converted back. The conversion is done in an on-demand manner such that any extended attribute or ACL writes cause the conversion for that file object to occur.
Item | Description |
---|---|
-p Prototype | Specifies the name of the prototype file when you create a JFS file system. 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 must be used) or gigabytes (suffix G must be used). See JFS and JFS2 for more information. |
Item | Description |
---|---|
-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. |
"/"
"/usr"
"/var"
"/opt"
Access Control: Only the root user or a member of the system group can run this command.
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).mkfs -s 8192 -o nbpi=2048,frag=512 /dev/lv01
This
command creates an empty 4 MB file system on the /dev/lv01 device
with 512-byte fragments and 1 i-node for each 2048 bytes.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 i-node for every 131072 bytes of disk.
The size of the file system will be the size of the logical volume
lv01.mkfs -s 4M -o nbpi=2048, frag=512 /dev/lv01
This
command creates an empty 4 MB file system on the /dev/lv01 device
with 512-byte fragments and one i-node for each 2048 bytes.mkfs -V jfs2 -o ea=v2 /dev/lv01
This
command creates an empty file system on the /dev/lv01 device
with v2 format for extended attributes.Item | Description |
---|---|
/etc/vfs | Contains descriptions of virtual file system types. |
/etc/filesystems | Lists the known file systems and defines their characteristics. |