-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage_diagnose.sh
More file actions
executable file
·83 lines (67 loc) · 2.24 KB
/
storage_diagnose.sh
File metadata and controls
executable file
·83 lines (67 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# storage_diagnose.sh - Collects comprehensive storage diagnostics on Ubuntu
OUTPUT="/tmp/storage_report_$(hostname)_$(date +%Y%m%d_%H%M%S).log"
echo "Saving storage diagnostics to: $OUTPUT"
exec > >(tee -a "$OUTPUT") 2>&1
echo "============================"
echo "📅 Date and Hostname"
echo "============================"
date
hostname
echo -e "\n============================"
echo "💽 Disk Usage (df -h)"
echo "============================"
df -hT
echo -e "\n============================"
echo "📁 Mount Points"
echo "============================"
mount | column -t
echo -e "\n============================"
echo "🔍 Largest Directories (Top 10 under /)"
echo "============================"
du -xh / --max-depth=1 2>/dev/null | sort -hr | head -n 10
echo -e "\n============================"
echo "📂 Largest Directories in /var"
echo "============================"
du -xh /var --max-depth=1 2>/dev/null | sort -hr | head -n 10
echo -e "\n============================"
echo "🧾 Filesystem Summary (lsblk)"
echo "============================"
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,UUID
echo -e "\n============================"
echo "🧮 Disk Partitions (fdisk -l)"
echo "============================"
sudo fdisk -l
echo -e "\n============================"
echo "🔐 LVM Volumes (if used)"
echo "============================"
sudo vgdisplay
sudo lvdisplay
echo -e "\n============================"
echo "📊 Inode Usage"
echo "============================"
df -ih
echo -e "\n============================"
echo "⚠️ Files Taking >100MB (Top 10)"
echo "============================"
find / -type f -size +100M -exec du -h {} + 2>/dev/null | sort -hr | head -n 10
echo -e "\n============================"
echo "🧪 ZFS Pools and Datasets (if available)"
echo "============================"
if command -v zpool &> /dev/null; then
zpool list
zfs list
else
echo "ZFS not installed"
fi
echo -e "\n============================"
echo "📦 Snapshots (if any)"
echo "============================"
if command -v btrfs &> /dev/null; then
sudo btrfs subvolume list /
elif command -v zfs &> /dev/null; then
zfs list -t snapshot
else
echo "No snapshot subsystem detected (btrfs/zfs)"
fi
echo -e "\n✅ Done. Full report saved to $OUTPUT"