### Install OCFS2 Tools from Source Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/users_guide.txt Instructions for installing OCFS2 tools from source code using autoconf. This involves downloading the source, configuring the build, compiling, and installing. It also mentions using a provided init script. ```bash ./configure && make && make install ``` -------------------------------- ### Enable OCFS2 Services on Boot Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.txt Commands to register and configure the o2cb and ocfs2 services to start automatically during system boot. ```bash # chkconfig --add o2cb # chkconfig --add ocfs2 # /etc/init.d/o2cb configure ``` -------------------------------- ### Manage OCFS2 Cluster Stack Lifecycle with O2CB Init Service Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt The /etc/init.d/o2cb script manages the OCFS2 cluster stack. It handles loading/unloading kernel modules, configuring the cluster to start on boot, and bringing the cluster online or offline. Requires root privileges. ```bash # Configure O2CB to start on boot /etc/init.d/o2cb configure # Answer prompts: # - Load O2CB driver on boot: y # - Cluster to start on boot: mycluster # Load O2CB kernel modules /etc/init.d/o2cb load # Unload O2CB kernel modules /etc/init.d/o2cb unload # Bring cluster online /etc/init.d/o2cb online mycluster # Take cluster offline /etc/init.d/o2cb offline mycluster # Combined start (load + online) /etc/init.d/o2cb start mycluster ``` -------------------------------- ### Enable OCFS2 Services for Boot Mounting Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Details the steps to enable and configure OCFS2 and o2cb services to ensure OCFS2 volumes are mounted automatically on system boot. ```bash # chkconfig --add o2cb # chkconfig --add ocfs2 # /etc.init.d/o2cb configure ``` -------------------------------- ### OCFS2 Cluster Configuration File Sample Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/users_guide.txt A sample configuration file for OCFS2, demonstrating the stanza format for cluster-wide settings and individual node configurations. It includes parameters like node count, cluster name, IP port, IP address, and node number. ```ini cluster: node_count = 3 name = OCFS2CLUSTER node: ip_port = 7777 ip_address = 139.185.118.107 number = 0 name = test1 cluster = OCFS2CLUSTER node: ip_port = 7777 ip_address = 139.185.118.106 number = 1 name = test2 ``` -------------------------------- ### OCFS2 Filesystem Lock Debugging with debugfs.ocfs2 Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.txt Demonstrates how to obtain a list of filesystem locks, their statuses, and how to interpret and map lock information using debugfs.ocfs2. This includes mounting debugfs, dumping lock states, and translating lock names to inode numbers and directory entries. ```bash # mount -t debugfs debugfs /debug # echo "fs_locks" | debugfs.ocfs2 /dev/sdX >/tmp/fslocks # echo "stat " | debugfs.ocfs2 /dev/sdX # echo "locate " | debugfs.ocfs2 /dev/sdX # echo "locate <419616>" | debugfs.ocfs2 /dev/sdX # echo "encode /linux-2.6.15/arch/i386/kernel/semaphore.c" | debugfs.ocfs2 /dev/sdX ``` -------------------------------- ### Mount OCFS2 for Oracle Home Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Demonstrates the standard mount command for OCFS2 volumes containing Oracle homes, without the special options used for data volumes. ```bash # mount -t ocfs2 /dev/sdb1 /software/orahome ``` -------------------------------- ### Mount OCFS2 Volume Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Demonstrates how to mount an OCFS2 volume using the 'mount' command. This is a fundamental operation for accessing OCFS2 storage. ```bash # mount -t ocfs2 /dev/sdX /dir ``` -------------------------------- ### Resize and Configure OCFS2 Journal with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Adjust the journal size or convert to a 64-bit journal for large filesystems using `tunefs.ocfs2 -J`. This is crucial for performance and handling large amounts of data. ```bash tunefs.ocfs2 -J size=128M /dev/sda1 ``` ```bash tunefs.ocfs2 -J block64 /dev/sda1 ``` -------------------------------- ### Grow OCFS2 Filesystem with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Expand an OCFS2 filesystem to fill the entire device or to a specific number of blocks using `tunefs.ocfs2 -S`. This operation increases the available space on the filesystem. ```bash tunefs.ocfs2 -S /dev/sda1 ``` ```bash tunefs.ocfs2 -S 1000000 /dev/sda1 ``` -------------------------------- ### Execute Commands from File with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Run a series of debugfs.ocfs2 commands specified in a file using the `-f` option. This allows for complex debugging sequences to be executed non-interactively. ```bash debugfs.ocfs2 -f commands.txt /dev/sda1 ``` -------------------------------- ### Configure OCFS2 fstab Entry Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.txt Configuration line for /etc/fstab to ensure OCFS2 volumes are mounted correctly at boot. The _netdev option is critical for network-dependent devices. ```bash /dev/sdX /dir ocfs2 noauto,_netdev 0 0 ``` -------------------------------- ### Create OCFS2 File System with mkfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt The mkfs.ocfs2 command creates an OCFS2 file system on a device. It supports various block and cluster sizes, advanced features like sparse files and reflinks, and cluster stack configurations. The tool detects if the volume is mounted elsewhere in the cluster to prevent data loss. ```bash # Basic format with default settings mkfs.ocfs2 /dev/sda1 # Format for database workloads with optimized settings # -b 4096: 4K block size (recommended for most cases) # -C 128k: 128K cluster size (optimal for large database files) # -L "DBF1": Volume label for easy identification # -N 4: Support up to 4 concurrent node mounts mkfs.ocfs2 -b 4096 -C 128K -L "DBF1" -N 4 /dev/sda1 # Format for small files (Oracle home, application files) mkfs.ocfs2 -b 4096 -C 4K -L "ORAHOME" -N 8 /dev/sdb1 # Format with maximum features enabled mkfs.ocfs2 --fs-feature-level=max-features -L "production" -N 16 /dev/sdc1 # Format with specific features (sparse files, reflinks, quotas) mkfs.ocfs2 --fs-features=sparse,unwritten,refcount,usrquota,grpquota \ -L "datastore" -N 8 /dev/sdd1 # Format for VM storage with appropriate filesystem type preset mkfs.ocfs2 -T vmstore -L "vmimages" -N 4 /dev/sde1 # Format with custom journal size (minimum 4M) mkfs.ocfs2 -J size=64M -L "highperf" -N 8 /dev/sdf1 # Format with 64-bit journal for very large filesystems mkfs.ocfs2 -J block64 -L "largefs" -N 16 /dev/sdg1 # Format local-only volume (no cluster required to mount) mkfs.ocfs2 -M local -L "localvol" /dev/sdh1 # Format with specific cluster stack configuration mkfs.ocfs2 --cluster-stack=o2cb --cluster-name=mycluster \ --global-heartbeat -L "clustervol" /dev/sdi1 # Dry-run to see calculated parameters without formatting mkfs.ocfs2 -n /dev/sdj1 # Force format (skip cluster check - use with caution!) mkfs.ocfs2 -F -L "testfs" /dev/sdk1 ``` -------------------------------- ### Basic Filesystem Information with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Retrieve fundamental filesystem information such as statistics, root directory contents, and superblock details using specific debugfs.ocfs2 commands. ```bash echo "stats" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "ls -l /" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "ls -l //" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "slotmap" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "hb" | debugfs.ocfs2 /dev/sda1 ``` -------------------------------- ### Inode and File Details with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Examine detailed inode information, file contents, and physical block mappings using commands like `stat`, `cat`, `dump`, and `bmap` within debugfs.ocfs2. ```bash echo "stat /path/to/file" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "cat /etc/passwd" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "dump /important/file /tmp/recovered_file" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "dump -p /important/file /tmp/recovered_file" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "rdump /data /tmp/recovered_data" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "bmap /largefile 1000" | debugfs.ocfs2 /dev/sda1 ``` -------------------------------- ### Control Filesystem Tracing with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Manage filesystem tracing by listing available trace bits or enabling specific tracing options for subsystems like SUPER or HEARTBEAT using `debugfs.ocfs2 -l`. This is essential for detailed debugging. ```bash debugfs.ocfs2 -l ``` ```bash debugfs.ocfs2 -l SUPER allow ``` ```bash debugfs.ocfs2 -l HEARTBEAT ENTRY EXIT allow ``` -------------------------------- ### Filesystem Performance and Locking Info with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Analyze filesystem fragmentation, indexed directory information, and lock states (filesystem, DLM, network) using commands like `frag`, `dx_dump`, `fs_locks`, `dlm_locks`, and `net_stats` in debugfs.ocfs2. ```bash echo "frag /largefile" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "dx_dump /largedir" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "fs_locks" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "dlm_locks" | debugfs.ocfs2 /dev/sda1 ``` ```bash echo "net_stats" | debugfs.ocfs2 /dev/sda1 ``` -------------------------------- ### Add Backup Superblocks with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Add backup superblocks to an OCFS2 filesystem if they were not created during the initial formatting, using `tunefs.ocfs2 --backup-super`. This enhances data recovery options. ```bash tunefs.ocfs2 --backup-super /dev/sda1 ``` -------------------------------- ### Query OCFS2 Filesystem Attributes with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Use `tunefs.ocfs2 -Q` to query various filesystem attributes like UUID, label, block size, cluster size, and node slots. This command is read-only and helps in understanding the current state of the OCFS2 filesystem. ```bash tunefs.ocfs2 -Q "UUID = %U\nLabel = %V\nBlock Size = %B\nCluster Size = %T\nNode Slots = %N\n" /dev/sda1 ``` ```bash tunefs.ocfs2 -Q "Incompat Features: %H\nRO Compat Features: %O\n" /dev/sda1 ``` -------------------------------- ### Check Mounted OCFS2 Volumes Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Illustrates various methods to verify if an OCFS2 volume is currently mounted, including using the 'mount' command and checking system files. ```bash # mount # cat /etc/mtab # cat /proc/mounts # /etc.init.d/ocfs2 status ``` -------------------------------- ### Format OCFS2 Volumes Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Instructions for formatting OCFS2 volumes using mkfs.ocfs2 with default or custom block and cluster size configurations. ```bash # mkfs.ocfs2 -L "oracle_home" /dev/sdX # mkfs.ocfs2 -b 4k -C 32K -L "oracle_home" -N 4 /dev/sdX ``` -------------------------------- ### List Sparse Files with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt List files containing holes (sparse files) on an OCFS2 filesystem using `tunefs.ocfs2 --list-sparse`. This is useful for identifying files that can benefit from the sparse feature. ```bash tunefs.ocfs2 --list-sparse /dev/sda1 ``` -------------------------------- ### OCFS2 Filesystem Tracing with debugfs.ocfs2 Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.txt Commands to enable, disable, and manage filesystem tracing using the debugfs.ocfs2 utility. This allows for detailed monitoring of OCFS2 internal states, such as SUPER bits and HEARTBEAT events. ```bash # debugfs.ocfs2 -l # debugfs.ocfs2 -l SUPER allow # debugfs.ocfs2 -l SUPER off # debugfs.ocfs2 -l SUPER deny # debugfs.ocfs2 -l HEARTBEAT ENTRY EXIT allow # debugfs.ocfs2 -l HEARTBEAT off ENTRY EXIT deny ``` -------------------------------- ### Interactive Debugging with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Open the OCFS2 filesystem in an interactive debugging mode using `debugfs.ocfs2`. This tool allows for detailed examination of filesystem structures, metadata, and debugging various issues. It can operate in read-only or read-write modes. ```bash debugfs.ocfs2 /dev/sda1 ``` ```bash debugfs.ocfs2 -w /dev/sda1 ``` ```bash debugfs.ocfs2 -s 1 /dev/sda1 ``` ```bash debugfs.ocfs2 -i /path/to/image.o2i ``` -------------------------------- ### Monitor OCFS2 DLM Statistics Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Shows how to view statistics for the OCFS2 Distributed Lock Manager (DLM), which can be helpful for diagnosing performance issues related to lock migration. ```bash # cat /proc/fs/ocfs2_dlm/*/stat ``` -------------------------------- ### Manage OCFS2 Cluster Services and Upgrades Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Commands to stop OCFS2 services, perform package upgrades, and configure system services for OCFS2 clusters. These steps are essential for maintaining cluster integrity during version transitions. ```bash umount -at ocfs2 /etc/init.d/o2cb offline /etc/init.d/o2cb unload rpm -Uvh ocfs2-tools-1.2.2-1.i386.rpm ocfs2console-1.2.2-1.i386.rpm rpm -Uvh ocfs2-2.6.9-42.0.3.ELsmp-1.2.4-2.i686.rpm chkconfig --add o2cb chkconfig --add ocfs2 /etc/init.d/o2cb configure ``` -------------------------------- ### Verify Backup Superblock Block Usage Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Runs a verification script to identify which files or inodes are occupying the blocks intended for backup superblocks. This helps resolve conflicts when enabling the feature. ```bash ./verify_backup_super /dev/sdX ``` -------------------------------- ### Mount OCFS2 for Oracle RAC Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.txt Specific mount options for Oracle RAC environments. Use 'datavolume' and 'nointr' for database files, while standard mounts are used for Oracle home directories. ```bash # mount -o datavolume,nointr -t ocfs2 /dev/sda1 /u01/db # mount -t ocfs2 /dev/sdb1 /software/orahome ``` -------------------------------- ### Manage OCFS2 Filesystem Features with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Enable, disable, or manage specific filesystem features like sparse files, quotas, and extended attributes using `tunefs.ocfs2 --fs-features`. Features can be enabled individually or in groups, and disabled by prepending 'no'. ```bash tunefs.ocfs2 --fs-features=sparse /dev/sda1 ``` ```bash tunefs.ocfs2 --fs-features=sparse,unwritten,inline-data,xattr /dev/sda1 ``` ```bash tunefs.ocfs2 --fs-features=noinline-data /dev/sda1 ``` ```bash tunefs.ocfs2 --fs-features=usrquota,grpquota /dev/sda1 ``` -------------------------------- ### Execute Single Commands with debugfs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Execute a single debugfs.ocfs2 command and exit immediately using the `-R` option. This is useful for scripting and automated checks. ```bash debugfs.ocfs2 -R "stats" /dev/sda1 ``` -------------------------------- ### OCFS2 Cluster Configuration Parameters Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/users_guide.txt Defines valid parameters for the cluster and node stanzas in the OCFS2 cluster configuration file. Parameters include node count, cluster name, IP port, IP address, and node number, with specific rules for uniqueness and matching. ```text cluster stanza: node_count - number of nodes in the cluster. name - name of the cluster. node stanza: ip_port - IP port for OCFS2 cluster stack communication. ip_address - IP address of the OCFS2 interconnect interface. number - unique node number in the cluster. name - name of this node. cluster - name of the cluster, must match the cluster stanza. ``` -------------------------------- ### OCFS2 fstab Entry Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Provides the correct entry format for an OCFS2 volume in the /etc/fstab file, enabling automatic mounting. ```bash /dev/sdX /dir ocfs2 noauto,\_netdev 0 0 ``` -------------------------------- ### Mount OCFS2 Volume by Label Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Mounting a formatted OCFS2 volume using its assigned label for easier identification in shared disk environments. ```bash # mount -L "label" /dir ``` -------------------------------- ### Update OCFS2 Cluster Stack Info with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Synchronize the on-disk cluster stack information to match the running cluster configuration using `tunefs.ocfs2 --update-cluster-stack`. This ensures consistency in clustered environments. ```bash tunefs.ocfs2 --update-cluster-stack /dev/sda1 ``` -------------------------------- ### Mount OCFS2 for Oracle RAC Data Volumes Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Specifies the required mount options ('datavolume', 'nointr') for OCFS2 volumes used to store Oracle RAC data files, voting disks, and control files. ```bash # mount -o datavolume,nointr -t ocfs2 /dev/sda1 /u01/db ``` -------------------------------- ### Detect and Display OCFS2 Volume Information Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt The mounted.ocfs2 command scans system partitions to detect OCFS2 volumes. It displays details such as labels, UUIDs, cluster stack information, and mount status on different nodes. The -d flag provides a detailed view, while -f shows which nodes have volumes mounted. ```bash # Scan all partitions for OCFS2 volumes mounted.ocfs2 # Check specific device mounted.ocfs2 /dev/sda1 # Detailed view with labels, UUIDs, and cluster info # Stack types: o2cb, pcmk, cman, None (local mount) # Flags: G = global heartbeat mounted.ocfs2 -d # Full detect showing which nodes have volumes mounted # Note: Information may be stale for uncleanly unmounted volumes mounted.ocfs2 -f ``` -------------------------------- ### Retroactively Enable Backup Superblock Source: https://github.com/markfasheh/ocfs2-tools/blob/master/documentation/ocfs2_faq.html Uses tunefs.ocfs2 to add backup superblocks to an existing volume. It requires user confirmation and may fail if the target backup blocks are currently in use by the filesystem. ```bash tunefs.ocfs2 --backup-super /dev/sdX ``` -------------------------------- ### Manage OCFS2 UUID with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Reset the volume UUID to a newly auto-generated one or set a specific UUID using `tunefs.ocfs2 -U`. Use extreme caution when setting a specific UUID to ensure uniqueness. ```bash tunefs.ocfs2 -U /dev/sda1 ``` ```bash tunefs.ocfs2 -U 2a4d1c58-1faa-42a1-a41d-26efc90c1315 /dev/sda1 ``` -------------------------------- ### Update Cloned OCFS2 Volume with tunefs.ocfs2 Source: https://context7.com/markfasheh/ocfs2-tools/llms.txt Update a cloned OCFS2 volume with a new label and optionally a new UUID using `tunefs.ocfs2 --cloned-volume`. This is useful when replicating or cloning existing filesystems. ```bash tunefs.ocfs2 --cloned-volume=newclonelabel /dev/sda1 ```