Tuning OCFS2 Using Mounted.OCFS2 & Debugfs.ocfs2 Commands….

Use the mounted.ocfs2 command to detect and list all OCFS2 volumes. This command scans all devices in /proc/partitions. The following example lists all OCFS2 devices:

# mounted.ocfs2 -d

Device Stack Cluster F UUID Label

/dev/xvdf o2cb …

/dev/xvdf1 o2cb …     myvolume

The following example lists the nodes currently mounting each volume:

# mounted.ocfs2 -f

Device Stack Cluster F Nodes

/dev/xvdf o2cb Heartbeat device

/dev/xvdf1 o2cb host01, host02

Use the debugfs.ocfs2 command to display file system structures. This is an interactive file system debugger for OCFS2 and is modeled after debugfs for ext3 file systems. It allows you to display directory structures, examine inodes and backup files, and trace events in the OCFS2 driver. The following example lists all trace bits and their statuses:

# debugfs.ocfs2 –l

You can control file system tracing by enabling and disabling specific trace bits by using the following syntax:

debugfs.ocfs2 –l <tracebit> allow|off|deny

OCFS2 uses the virtual file system, debugfs, to expose its in-kernel information to user space. This allows you to list the file system cluster locks, dlm locks, dlm state, and other states. Access the information by mounting the file system at /sys/kernel/debug. To auto-mount debugfs, add the following entry to /etc/fstab:

debugfs /sys/kernel/debug debugfs defaults 0 0

Use the o2image command to back up the OCFS2 file system metadata from a device to a specified image file. This image file contains the file system skeleton, including inodes, directory names, and file names. The image file does not include any file data. The following example creates the image file, /tmp/xvdf1.img, from the file system on /dev/xvdf1:

# o2image /dev/xvdf1 /tmp/xvdf1.img

You can determine the cause of a file system corruption or performance problem by using debugfs.ocfs2 to open the image file and analyze the file system layout.