#!/bin/sh DEBUGFS=`which debugfs.ocfs2` usage() { echo "usage: stat_sysdir.sh -d sda1,sdb1" exit 1; } OPTIND=1 while getopts "d:" args do case "$args" in d) devices="$(echo $OPTARG | sed 's/,/ /g')";; esac done if [ -z "$devices" ] ; then usage ; fi for i in $devices do DEV=/dev/$i echo "Device: ${DEV}" SLOTS=`echo "stats" | ${DEBUGFS} -n ${DEV} | awk '/Max Node Slots:/ { print $4 }'` if [ -z ${SLOTS} ] then continue; fi echo " superblock" echo "stats" | ${DEBUGFS} -n ${DEV} echo " //global_bitmap" echo "stat //global_bitmap" | ${DEBUGFS} -n ${DEV} echo " //global_inode_alloc" echo "stat //global_inode_alloc" | ${DEBUGFS} -n ${DEV} echo " //slot_map" echo "stat //slot_map" | ${DEBUGFS} -n ${DEV} echo " //heartbeat" echo "stat //heartbeat" | ${DEBUGFS} -n ${DEV} for j in `seq --format="%04g" 0 $[${SLOTS}-1]` do INODE=//inode_alloc:$j EXTNT=//extent_alloc:$j LOCAL=//local_alloc:$j TRUNC=//truncate_log:$j JOURN=//journal:$j ORPHN=//orphan_dir:$j echo " ${INODE}" echo "stat ${INODE}" | ${DEBUGFS} -n ${DEV} echo " ${EXTNT}" echo "stat ${EXTNT}" | ${DEBUGFS} -n ${DEV} echo " ${LOCAL}" echo "stat ${LOCAL}" | ${DEBUGFS} -n ${DEV} echo " ${TRUNC}" echo "stat ${TRUNC}" | ${DEBUGFS} -n ${DEV} echo " ${JOURN}" echo "stat ${JOURN}" | ${DEBUGFS} -n ${DEV} echo " ${ORPHN}" echo "ls -l ${ORPHN}" | ${DEBUGFS} -n ${DEV} done; echo " " done;