summaryrefslogtreecommitdiffstats
path: root/extras/quota/log_accounting.sh
diff options
context:
space:
mode:
authorSanoj Unnikrishnan <sunnikri@redhat.com>2017-06-29 15:39:35 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-06-30 08:39:05 +0000
commit50d72373fadf1174918e754e31bae3806aa4c214 (patch)
tree7bbd7c860e5694a6b7315ab4dbfefd54ff3a0f79 /extras/quota/log_accounting.sh
parent292b4e42fdc023e307fde35e189285040d4b9cdd (diff)
Scripts to identify quota accouting issues
The patch contains 2 scripts: log_accounting.sh does a du -h on the FS hierarchy and a quota list on the hierarchy and interleaves the two output. We can then identify which directory(s) in FS has caused the accounting to go bad and try to investigate what fops happened on those directories. We can also limit the set of directories on which we need to set dirty xattr to correct accounting. xattr_analysis.py reads all the xattr of a brick and dumps it a human readable form to ease debugging. Change-Id: I2155561d10c08dc3ab9e8b09dbd258f0592b4d33 BUG: 1466188 Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com> Reviewed-on: https://review.gluster.org/17649 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'extras/quota/log_accounting.sh')
-rwxr-xr-xextras/quota/log_accounting.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/extras/quota/log_accounting.sh b/extras/quota/log_accounting.sh
new file mode 100755
index 00000000000..9c2381f6a95
--- /dev/null
+++ b/extras/quota/log_accounting.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/bash
+# The script does an accounting of all directories using command 'du' and
+# using gluster. We can then compare the two to identify accounting mismatch
+# THere can be minor mismatch because gluster only accounts for the size of
+# files. Direcotries can take up upto 4kB space on FS per directory. THis
+# size is accounted by du and not by gluster. However the difference would
+# not be significant.
+
+mountpoint=$1
+volname=$2
+
+usage ()
+{
+ echo >&2 "usage: $0 <mountpoint> <volume name>"
+ exit
+}
+
+[ $# -lt 2 ] && usage
+
+cd $mountpoint
+du -h | head -n -1 | tr -d '.' |awk '{ for (i = 2; i <= NF; i++) { printf("%s ", $i);} print "" }' > /tmp/gluster_quota_1
+cat /tmp/gluster_quota_1 | sed 's/ $//' | sed 's/ /\\ /g' | sed 's/(/\\(/g' | sed 's/)/\\)/g' |xargs gluster v quota $volname list > /tmp/gluster_quota_2
+du -h | head -n -1 |awk '{ for (i = 2; i <= NF; i++) { printf("%s %s", $i, $1);} print "" }' | tr -d '.' > /tmp/gluster_quota_3
+cat /tmp/gluster_quota_2 /tmp/gluster_quota_3 | sort > /tmp/gluster_quota_4
+find . -type d > /tmp/gluster_quota_5
+tar -cvf /tmp/gluster_quota_files.tar /tmp/gluster_quota_*