Bash public

Disk Inode Pressure

Share this script safely, inspect its metadata, and copy the exact command you need.

Dashboard

Ready to run

One-liner

Copy the command, then review before execution.
curl -fsSL https://runny.sh/r/8T2MXVDAYQ13 | bash

Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.129

At a glance

Script metadata

Slug
8T2MXVDAYQ13
Fetches
0
Size
1657 B · 65 lines
Expires
never
Last fetch
Created
2026-09-07 00:35:59.020
Description
Inode use on local filesystems

Readable before runnable

Preview

#!/usr/bin/env bash
# Disk inode pressure
# Read-only: reports inode use from df -i. Warns at >=85%, critical at >=95%.
# Exit 0 if healthy, 1 if warning, 2 if critical.
# Hosted on Runny.sh. Review the script page before you run it.

set -u

status=0
seen=0
note() { printf '%s\n' "$*"; }
bump() {
  case $1 in
    crit) status=2 ;;
    warn) [ "$status" -lt 1 ] && status=1 ;;
  esac
}

note "=== Disk inode pressure ==="
note "Host:     $(hostname 2>/dev/null || printf unknown)"
note ""

if ! command -v df >/dev/null 2>&1; then
  note "df:       not found in PATH"
  note "Result: CRITICAL"
  exit 2
fi

while IFS= read -r line; do
  mount=$(printf '%s\n' "$line" | awk '{print $6}')
  used=$(printf '%s\n' "$line" | awk '{gsub(/%/, "", $5); print $5}')
  inodes=$(printf '%s\n' "$line" | awk '{print $2}')
  ifree=$(printf '%s\n' "$line" | awk '{print $4}')
  case "$mount" in
    ''|Mounted|/boot/efi|/snap/*|/run|/run/*|/dev|/dev/*|/sys|/sys/*|/proc|/proc/*) continue ;;
  esac
  case "$used" in
    ''|*[!0-9]*) continue ;;
  esac
  seen=1
  note "  ${mount}: ${used}% inodes used  (${ifree} free of ${inodes})"
  if [ "$used" -ge 95 ]; then
    note "           CRITICAL: inode table is nearly exhausted"
    bump crit
  elif [ "$used" -ge 85 ]; then
    note "           WARNING: inode use is high"
    bump warn
  fi
done <<EOF
$(df -iP -x tmpfs -x devtmpfs -x overlay -x squashfs -x ramfs 2>/dev/null | awk 'NR > 1')
EOF

if [ "$seen" -eq 0 ]; then
  note "  no local filesystems reported"
  bump warn
fi
note ""

case $status in
  0) note "Result: HEALTHY" ;;
  1) note "Result: WARNING" ;;
  *) note "Result: CRITICAL" ;;
esac
exit "$status"

Raw endpointhttps://runny.sh/r/8T2MXVDAYQ13

See something unsafe?

Report this script

Tell us why it should come down. Anyone can also report a URL at /abuse.

Restore revision