mkfs.ocfs2(8)
๐ mkfs.ocfs2 โ OCFS2 Manual Pages ๐
okay bestie, buckle up, because we're about to talk about the OCFS2 manual page mkfs.ocfs2(8) and honestly? it's a lot, but we're gonna get through it together ๐ซถ
โจ NAME โจ
mkfs.ocfs2 โ creates an OCFS2 file system. that's it, that's the whole vibe. it makes filesystems. iconic behavior honestly ๐
๐ธ SYNOPSIS ๐ธ
mkfs.ocfs2 [-b block-size] [-C cluster-size] [-L volume-label] [-M
mount-type] [-N number-of-nodes] [-J journal-options]
[--fs-features=[no]sparse...] [--fs-feature-level=feature-level] [-T
filesystem-type] [--cluster-stack=stackname]
[--cluster-name=clustername] [--global-heartbeat] [--discard |
--nodiscard] [-FqvV] device [blocks-count]
like, look at all those little flags. they're all important, we're gonna go through every single one, no skipping, no cap ๐ฅ
๐ฆ DESCRIPTION ๐ฆ
so mkfs.ocfs2 is the girl whose whole job is creating an OCFS2 file system on a device, which is usually a partition on a shared disk. she's the moment. she's the blueprint. โจ
and listen, she's also careful โ because we do not do data loss in this house. so if mkfs.ocfs2 peeks at an existing OCFS2 volume and notices it's mounted on another node in the cluster, she will simply not format it. protective queen behavior fr fr ๐ก๏ธ
also important: this tool needs the cluster service to be online. like, it's not optional, it's the whole mood. if the cluster service is not up, this is not happening.
๐ OPTIONS ๐
here comes the part where I tell you about every flag, because every flag matters, and I refuse to gatekeep.
-b,--block-sizeblock-size โ sets the block size. the valid values are512,1K,2Kand4Kbytes per block. if you don't say anything, a value gets heuristically determined based on what the file system is expected to be used for (peep the-Toption, she knows things). and bestie, a block size of512bytes is never recommended โ like, ever. choose1K,2Kor4K. that's the move. ๐-C,--cluster-sizecluster-size โ sets the cluster size. valid values are4K,8K,16K,32K,64K,128K,256K,512Kand1M. if omitted, a value gets heuristically determined based on the expected usage of the file system (again, that's the-Toption doing her thing). for volumes expected to store large files โ think database files โ a cluster size of128Kor more is the recommendation, but you can opt for a smaller size as long as that value is not smaller than the database block size. for everything else, use4K. simple as. ๐-F,--forceโ so for existing OCFS2 volumes,mkfs.ocfs2makes sure the volume isn't mounted on any node in the cluster before formatting. for that check to work, she expects the cluster service to be online. specify this option to disable that check. yes, that means skipping the safety net. do with that information what you will. ๐ญ-J,--journal-optionsoptions โ creates the journal using options specified on the command-line. journal options are comma separated, and may take an argument using the equals (=) sign. the following options are supported:size=journal-sizeโ creates a journal of size journal-size. minimum size is4M. if omitted, a value is heuristically determined based upon the file system size. โจblock32โ uses a standard 32bit journal. the journal will be able to access up to2^32-1blocks. this is the default. it has been the journal format for OCFS2 volumes since the beginning (elder emoji, respect her ๐). the journal is compatible with all versions of OCFS2. prependingnois equivalent to theblock64journal option.block64โ uses a 64bit journal. the journal will be able to access up to2^64-1blocks. this allows large filesystems that can extend to the theoretical limits of OCFS2. it requires a new-enough filesystem driver that uses the new journalled block device,JBD2. prependingnois equivalent to theblock32journal option.
-L,--labelvolume-label โ sets the volume label for the file system. this is super useful for mounting-by-label (iykyk). keep the label under64bytes, bestie, that's the limit. ๐ท๏ธ-M,--mountmount-type โ valid types arelocalandcluster. local mount lets users mount the volume without the cluster overhead, and it works only with OCFS2 bundled with Linux kernels2.6.20or later. defaults tocluster. ๐ซ-N,--node-slotsnumber-of-node-slots โ valid number ranges from1to255. this number specifies the maximum number of nodes that can concurrently mount the partition. if omitted, the number depends on volume size: for volume size< 2G, it's2; for2G <= size < 10G, it's4; for10G <= size < 1T, it's8; for other size, it's16. and guess what โ the number of slots can be later tuned up or down usingtunefs.ocfs2. so you're not locked in forever, periodt. ๐ข-Tfilesystem-type โ specifies how the filesystem is going to be used, so thatmkfs.ocfs2can choose optimal filesystem parameters for that use. the supported filesystem types are:mailโ appropriate for file systems that will host lots of small files. ๐งdatafilesโ appropriate for file systems that will host a relatively small number of very large files. ๐๏ธvmstoreโ appropriate for file systems that will host Virtual machine images. ๐ฅ๏ธ
--fs-features=[no]sparse...โ turns specific file system features on or off. a comma separated list of feature flags can be provided, andmkfs.ocfs2will try to create the file system with those features set according to the list. to turn a feature on, include it in the list. to turn a feature off, prependnoto the name. choices here will override individual features set via the--fs-feature-leveloption. and bestie, please refer to the section titled feature compatibility before selecting specific features โ that's not a suggestion, that's a heads up. ๐จ the following flags are supported:backup-superโmkfs.ocfs2, by default, makes up to 6 backup copies of the super block at offsets1G,4G,16G,64G,256Gand1Tdepending on the size of the volume. this can be useful in disaster recovery. this feature is fully compatible with all versions of the file system and generally should not be disabled. like, she's your safety net, leave her alone. ๐localโ creates the file system as a local mount, so that it can be mounted without a cluster stack.sparseโ enables support for sparse files. with this, OCFS2 can avoid allocating (and zeroing) data to fill holes. turn this feature on if you can, otherwise extends and some writes might be less performant. so like, on = good vibes. โจunwrittenโ enables unwritten extents support. with this turned on, an application can request that a range of clusters be pre-allocated within a file. OCFS2 will mark those extents with a special flag so that expensive data zeroing doesn't have to be performed. reads and writes to a pre-allocated region act as reads and writes to a hole, except a write will not fail due to lack of data allocation. this feature requires sparse file support to be turned on. no sparse, no unwritten, that's the rule. ๐inline-dataโ enables inline-data support. if this feature is turned on, OCFS2 will store small files and directories inside the inode block. data is transparently moved out to an extent when it no longer fits inside the inode block. in some cases, this can also make a positive impact on cold-cache directory and file operations. cute and efficient, we love her. ๐extended-slotmapโ the slot-map is a hidden file on an OCFS2 fs which is used to map mounted nodes to system file resources. the extended slot map allows a larger range of possible node numbers, which is useful for userspace cluster stacks. if required, this feature is automatically turned on bymkfs.ocfs2. she handles it herself, don't stress. ๐metaeccโ enables metadata checksums. with this enabled, the file system computes and stores the checksums in all metadata blocks. it also computes and stores an error correction code capable of fixing single bit errors. math girlboss energy, honestly. ๐งฎrefcountโ enables creation of reference counted trees. with this enabled, the file system allows users to create inode-based snapshots and clones known as reflinks. snapshots?? clones?? yes bestie, that's the vibe. ๐ธxattrโ enables extended attributes support. with this enabled, users can attachname:valuepairs to objects within the file system. in OCFS2, the names can be up to255bytes in length, terminated by the first NUL byte. while it is not required, printable names (ASCII) are recommended. the values can be up to64KBof arbitrary binary data. attributes can be attached to all types of inodes: regular files, directories, symbolic links, device nodes, etc. this feature is required for users wanting to use extended security facilities like POSIX ACLs or SELinux. ๐ท๏ธusrquotaโ enables user quota support. with this feature enabled, the filesystem will track amount of space and number of inodes (files, directories, symbolic links) each user owns. it is then possible to limit the maximum amount of space or inodes a user can have. see a documentation ofquota-toolspackage for more details. ๐คgrpquotaโ enables group quota support. with this feature enabled, the filesystem will track amount of space and number of inodes (files, directories, symbolic links) each group owns. it is then possible to limit the maximum amount of space or inodes a user can have. see a documentation ofquota-toolspackage for more details. ๐ฅindexed-dirsโ enables directory indexing support. with this feature enabled, the file system creates indexed tree for non-inline directory entries. for large scale directories, directory entry lookup performance from the indexed tree is faster then from the legacy directory blocks. (yes, "then" โ I'm keeping it exactly as she wrote it, no cap ๐ซถ)discontig-bgโ enables discontiguous block groups. with this feature enabled, the file system is able to grow the inode and the extent allocators even when there is no contiguous free chunk available. it allows the file system to grow the allocators in smaller (discontiguous) chunks. โจclusterinfoโ enables storing the cluster stack information in the superblock. this feature is needed to support userspace cluster stacks and the global heartbeat mode in theo2cbcluster stack. if needed, this feature is automatically turned on bymkfs.ocfs2. ๐ซ
okay that's part one bestie, and we are not done โ more of this manual page is coming, so don't go anywhere ๐
--fs-feature-level=feature-levelโ bestie, this one lets you pick a pre-determined set of filesystem features. It's literally designed so users can conveniently choose a set of filesystem features that fits their needs. And no cap: there is no downside to trying a set of features which your module might not support โ if it won't mount the new filesystem, simply reformat at a lower level. Feature levels can be fine-tuned via the--fs-featuresoption. Currently, there are 3 types of feature levels:max-compatโ chooses fewer features but ensures that the filesystem can be mounted from older versions of the OCFS2 module. safe and cozy ๐ซถdefaultโ the default feature set tries to strike a balance between providing new features and maintaining compatibility with relatively recent versions of OCFS2. It currently enablessparse,unwritten,inline-data,xattr,indexed-dirs,discontig-bg,refcount,extended-slotmapandclusterinfo.max-featuresโ choose the maximum amount of features available. This will typically provide the best performance from OCFS2 at the expense of creating a filesystem that is only compatible with very recent versions of the OCFS2 kernel module. high risk, high reward energy โจ
--cluster-stackโ specify the cluster stack. This option is normally not required asmkfs.ocfs2chooses the currently active cluster stack. It is required only if the cluster stack is not online and the user wishes to use a stack other than the default,o2cb. Other supported cluster stacks arepcmk(Pacemaker) andcman(rgmanager). Once set, OCFS2 will only allow mounting the volume if the active cluster stack and cluster name matches the one specified on-disk. iykyk ๐ฆ--cluster-nameโ specify the name of the cluster. This option is mandatory if the user has specified a cluster-stack. This name is restricted to a max of 16 characters. Additionally, theo2cbcluster stack allows only alpha-numeric characters. keep it short, keep it cute ๐--global-heartbeatโ enable the global heartbeat mode of theo2cbcluster stack. This option is not required if theo2cbcluster stack with global heartbeat is online asmkfs.ocfs2will detect the active stack. However, if the cluster stack is not up, then this option is required alongwith cluster-stack and cluster-name. For more, refer too2cb(7). ๐--discardโ attempt to discard blocks at mkfs time (discarding blocks initially is useful on solid state devices and sparse / thin-provisioned storage). When the device advertises that discard also zeroes data (any subsequent read after the discard and before write returns zero), then mark all not-yet-zeroed blocks as zeroed. This significantly speeds up filesystem initialization. This is set as default. speedy queen ๐ธ--nodiscardโ do not attempt to discard blocks at mkfs time. the opposite vibe ๐--no-backup-superโ this option is deprecated, please use--fs-features=nobackup-superinstead. > deprecated alert! don't use this one, use the other one bestie ๐ญ-n,--dry-runโ display the heuristically determined values without overwriting the existing filesystem. preview mode, no take-backs ๐-q,--quietโ quiet mode. ๐คซ-Uuuid โ specify a custom UUID in the plain (2A4D1C581FAA42A1A41D26EFC90C1315) or traditional (2a4d1c58-1faa-42a1-a41d-26efc90c1315) format. This option is not recommended because the filesystem uses the UUID to uniquely identify a filesystem. If more than one filesystem were to have the same UUID, one is very likely to encounter erratic behavior, if not, outright filesystem corruption. > โ ๏ธ seriously, don't unless you know exactly what you're doing ๐-v,--verboseโ verbose mode. ๐ฃ๏ธ-V,--versionโ print version and exit. โญ- blocks-count โ usually
mkfs.ocfs2automatically determines the size of the given device and creates a filesystem that uses all of the available space on the device. This optional argument specifies that the filesystem should only consume the given number of filesystem blocks (see-b) on the device. tiny filesystem moment ๐
โจ FEATURE COMPATIBILITY โจ
This section lists the filesystem features that have been added to the OCFS2 filesystem and the version that it first appeared in. The table below lists the versions of the mainline Linux kernel and ocfs2-tools. Users should use this information to enable only those features that are available in the filesystem that they are using. Before enabling new features, users are advised to review the section titled feature values. do your homework bestie ๐
Here's the compatibility timeline, but make it a list because tables are not the vibe:
localโ Kernel Version:Linux 2.6.20; Tools Version:ocfs2-tools 1.2sparseโ Kernel Version:Linux 2.6.22; Tools Version:ocfs2-tools 1.4unwrittenโ Kernel Version:Linux 2.6.23; Tools Version:ocfs2-tools 1.4inline-dataโ Kernel Version:Linux 2.6.24; Tools Version:ocfs2-tools 1.4extended-slotmapโ Kernel Version:Linux 2.6.27; Tools Version:ocfs2-tools 1.6metaeccโ Kernel Version:Linux 2.6.29; Tools Version:ocfs2-tools 1.6grpquotaโ Kernel Version:Linux 2.6.29; Tools Version:ocfs2-tools 1.6usrquotaโ Kernel Version:Linux 2.6.29; Tools Version:ocfs2-tools 1.6xattrโ Kernel Version:Linux 2.6.29; Tools Version:ocfs2-tools 1.6indexed-dirsโ Kernel Version:Linux 2.6.30; Tools Version:ocfs2-tools 1.6refcountโ Kernel Version:Linux 2.6.32; Tools Version:ocfs2-tools 1.6discontig-bgโ Kernel Version:Linux 2.6.35; Tools Version:ocfs2-tools 1.6clusterinfoโ Kernel Version:Linux 2.6.37; Tools Version:ocfs2-tools 1.8
Users can query the features enabled in the filesystem as follows:
# tunefs.ocfs2 -Q "Label: %V\nFeatures: %H %O\n" /dev/sdg1
Label: apache_files_10
Features: sparse inline-data unwritten
โจ FEATURE VALUES โจ
okay bestie this part is literally the cheat sheet ๐ this is where we spill the hex values that go with each file system feature. super useful when you're debugging mount failures that happen because of feature incompatibility, iykyk.
so picture this: someone tries to mount an OCFS2 volume that has features enabled which the running file system software does not support. it's gonna fail, and it's gonna fail with an error like:
ERROR: couldn't mount because of unsupported optional features (200).
and now you're like ??? ๐ but wait โ peek at the list below and it becomes so obvious: they tried to mount a volume with the xattr (extended attributes) feature turned on, using a version of the file system software that didn't support it. classic. at this point the user has two options, and only two:
- upgrade the file system software, or
- disable that on-disk feature using
tunefs.ocfs2.
some features are lowkey chill and will let the file system mount with an older version of the software โ but only if the mount is read-only. if someone tries to mount a volume like that in read-write mode, it fails with an error like:
ERROR: couldn't mount RDWR because of unsupported optional features (1).
this one means the volume had the unwritten RO Compat feature enabled, and a volume like that can only be mounted by older file system software in read-only mode. so again, two options bestie:
- mount the volume with the
romount option, or - disable that on-disk feature using
tunefs.ocfs2.
๐ The Feature Table (as a list bc we're cozy like that) ๐
Incompat ๐ซ
localโ hex value8sparseโ hex value10inline-dataโ hex value40extended-slotmapโ hex value100xattrโ hex value200indexed-dirsโ hex value400metaeccโ hex value800refcountโ hex value1000discontig-bgโ hex value2000clusterinfoโ hex value4000
RO Compat ๐ธ
unwrittenโ hex value1usrquotaโ hex value2grpquotaโ hex value4
๐ SEE ALSO ๐
debugfs.ocfs2(8) fsck.ocfs2(8) mount.ocfs2(8) mounted.ocfs2(8) o2cb(7) o2cluster(8) o2image(8) o2info(1) tunefs.ocfs2(8)
like, go read those too, they're the rest of the squad ๐ซถ
๐ AUTHORS ๐
Oracle Corporation
๐ COPYRIGHT ๐
Copyright ยฉ 2004, 2012 Oracle. All rights reserved.
and that's the whole page bestie, we ate and left no crumbs ๐ this was Version 1.8.9, dated January 2012, and it's the mkfs.ocfs2(8) manual page โ iconic behavior honestly ๐ now go format something pretty โจ๐ฆ๐
๐ฆ where this page comes from
- fedora 44: ocfs2-tools 1.8.9-2.fc44 ยท GPL-2.0-only
- fedora 44: ocfs2-tools 1.8.9-2.fc44 ยท GPL-2.0-only
- ubuntu resolute: ocfs2-tools 1.8.9-1 ยท GPL-2.0-or-later
- ubuntu stonking: ocfs2-tools 1.8.9-1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms