Filesystem Forced fsck all disks.
The script does:
- Detects all
ext4filesystems (including LVM volumes) - Forces a one-time filesystem check at next boot using
tune2fs -c 1 - Ensures
/etc/fstabstays exactly like it was, without changing anything - Reboots the system with
fsckforced
✅ Final Script — force_fsck_all.sh
#!/bin/bash
echo "🔍 Detecting all ext4 filesystems..."
FILESYSTEMS=$(lsblk -pn -o FSTYPE,NAME | awk '$1 == "ext4" { print $2 }')
echo
echo "🛠️ Forcing fsck on next boot for these filesystems:"
echo "$FILESYSTEMS"
echo
for FS in $FILESYSTEMS; do
echo "→ Setting fsck trigger for $FS"
tune2fs -c 1 "$FS"
done
echo
echo "✅ Done. /etc/fstab was not modified."
echo
read -p "⚠️ Reboot now to run fsck on next boot? (y/N): " confirm
if [[ "$confirm" =~ ^[Yy]$ ]]; then
echo "🔁 Rebooting with forced fsck..."
shutdown -rF now
else
echo "❌ Reboot skipped. Run 'shutdown -rF now' manually when ready."
fi
🚀 How to Use
-
Create the script:
nano force_fsck_all.sh
Paste the script above. Save (Ctrl+O, Enter) and exit (Ctrl+X).
-
Make it executable:
chmod +x force_fsck_all.sh
-
Run it as root:
./force_fsck_all.sh
🔒 Why /etc/fstab is not modified
This version:
- Does not touch or modify
/etc/fstabat all - Assumes that your current
/etc/fstabis correctly set (which it is)
That way, nothing will break, and the root fs stays set to 1, exactly as Proxmox originally configured it.
Ins0mniA