Tuning OCFS2 Volumes….

Use the tunefs.ocfs2 command to change file system parameters. You can change all parameters except block size and cluster size. The options for tunefs.ocfs2 are similar to the options for the mkfs.ocfs2 command. Some changes require the cluster service to be online.

You can also use the tunefs.ocfs2 command with the -Q option to query the file system for specific attributes.

The following example queries block size (%B), cluster size (%T), number of node slots (%N), volume label (%V), volume UUID (%U), Compatible Features (%M), Incompatible Features (%H), and Read-Only Compatible Features (%O) for the OCFS2 volume on /dev/xvdf1. The example specifies labels for each attribute and displays each attribute on a new line:

# tunefs.ocfs2 –Q “Block Size: %B\nCluster Size: %T\nNode Slots:

%N\nVolume Label: %V\nVolume UUID: %U\nCompatible Features:

%M\nIncompatible Features: %H\n\Read-Only Compatible Features: %O\n”

/dev/xvdf1

Block Size: 4096

Cluster Size: 4096

Node Slots: 4

Volume Label: myvolume

Volume UUID: …

Sometimes it’s hard to capture a kernel panic: You don’t know how to reproduce the kernel panic and/or once you have rebooted your system, there are no clues in the logfiles. Netconsole is a kernel module that logs kernel printk messages over UDP allowing debugging of problems where disk logging fails.  It is recommended that netconsole be set up on each node in the OCFS2 cluster. To be able to use netconsole, you need to have an rsyslog server that is properly configured on your network.

Netconsole is provided by the netconsole-service packages in ol8_baseos_latest repository.

Since ocfs2 uses a specific port, 7777, it is easy to capture and view all ocfs2 traffic, including the Distributed Lock Manager (DLM) using tcpdump.

Compatible Features: backup-super strict-journal-super

Incompatible Features: sparse extended-slotmap inline-data xattr indexed-dirs refcount discontig-bg

Read-Only Compatible Features: unwritten

Use the fsck.ocfs2 command to detect and fix on-disk errors. The command expects the cluster service to be online to ensure that the volume is not in use by another node. Unmount the file system before running fsck.ocfs2. The following example runs a full scan of the file system:

# fsck.ocfs2 -f /dev/xvdf1

fsck.ocfs2 1.8.6

Checking OCFS2 filesystem in /dev/xvdf1:

Label: myvolume

UUID: …

Number of blocks: 2621184

Block size: 4096

Number of clusters: 2621184

Cluster size: 4096

Number of slots: 4

/dev/xvdf1 was run with -f, check forced.

Pass 0a: Checking cluster allocation chains

Pass 0b: Checking inode allocation chains

Pass 0c: Checking extent block allocation chains

Pass 1: Checking inodes and blocks

Pass 2: Checking directory entries

Pass 3: Checking directory connectivity

Pass 4a: Checking for orphaned inodes

Pass 4b: Checking inodes link counts

All passes succeeded.

The file system super block stores critical information such as the block size, cluster size, and locations of the root and system directories. A backup super block exists by default, as shown by the following example:

# tunefs.ocfs2 -Q “%M\n” /dev/xvdf1

backup-super strict-journal-super

The super block is not backed up on devices smaller than 1 GB. On devices that are larger than 1 GB, the mkfs.ocfs2 command makes up to six backup copies of the super block. The fsck.ocfs2 command refers to these six backups by number (1–6). In the unlikely event that the super block is corrupted, you can specify a backup to recover the super block. The following example overwrites the super block with the second backup:

# fsck.ocfs2 -f -r 2 /dev/xvdf1

fsck.ocfs2 1.8.6

[RECOVER_BACKUP_SUPERBLOCK] Recover superblock information from backup block#1048576? <n> y

Respond to the query with y to initiate the recovery.