Use the mkfs.ocfs2 command to create an OCFS2 volume on a device. You cannot use this utility to overwrite an existing volume that is mounted by another node in the cluster. This utility also requires that the cluster service is online. Though not required, it is recommended that you create OCFS2 volumes only on partitions. Only partitioned volumes can be mounted by the label. Labels are a must for ease of management in a cluster environment.
Some of the available options for mkfs.ocfs2 are listed as follows. All the options, with the exception of block size and cluster size, can be changed by using tunefs.ocfs2.
- -b|–block-size <block-size> – Specifies the smallest unit of I/O performed by the file system and the size of inode and extent blocks. Supported block sizes are 512 bytes, 1 KB, 2 KB, and 4 KB.
- -c|–cluster-size <cluster-size> – Specifies the smallest unit of space allocated for file data. Supported sizes are 4 KB, 8 KB, 16 KB, 32 KB, 64 KB, 128 KB, 512 KB, and 1 MB. When using the volume for storing database files, do not use a cluster size value smaller than the database block size.
- -L|–label <volume-label> – Specifies a name for the volume. In a cluster, nodes can detect devices in a different order, which could result in the same device having different names on different nodes. Labeling allows consistent naming for OCFS2 volumes across a cluster.
-T filesystem-type – Specifies usage of the file system. Valid types are:
- mail – Specify this type when you intend to use the file system as a mail server. Mail servers perform many metadata changes to many small files, which require the use of a large journal.
- datafiles – Specify this type when you intend to use the file system for database files. These file types use fewer fully allocated large files, with fewer metadata changes, and do not benefit from a large journal.
- vmstore – Specify this type when you intend to store virtual machine images. These file types are sparsely allocated large files and require moderate metadata updates.
Of course, you can check the mkfs.ocfs2(8) man page for a description of all options. Have fun.