Skip to content

Instantly share code, notes, and snippets.

@growse
Created May 17, 2023 09:24
Show Gist options
  • Save growse/81dca689e44f2049a1e90a1b6c14a053 to your computer and use it in GitHub Desktop.
Save growse/81dca689e44f2049a1e90a1b6c14a053 to your computer and use it in GitHub Desktop.
Keep hitting umount and fsck on a disk until it's clean.
#!/bin/bash
#
ext=100
DEVICE=$1
# Can get the devices / pvcs with this.
#thingies=$( mount | grep ro,|grep pvc| awk '{split($3,path,/\//); print $1 "|" path[9]}')
#for thingie in $thingies
#do
# IFS="|" read -r device pvc <<< $thingie
# echo $pvc
#done
echo $DEVICE
until [ $ext -lt 2 ]
do
umount $DEVICE ; fsck.ext4 -p $DEVICE
ext=$?
echo $ext
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment