Skip to content

Instantly share code, notes, and snippets.

@stackcoder
Created December 8, 2024 19:17
Show Gist options
  • Save stackcoder/c4b0afdf47bd72a3213a86b77297edce to your computer and use it in GitHub Desktop.
Save stackcoder/c4b0afdf47bd72a3213a86b77297edce to your computer and use it in GitHub Desktop.
Wipe free space on Android devices
#!/bin/bash
set -euxo pipefail
{
for path in "/system" "/data" "/cache" "/sdcard"; do
dst="$path/xxx-wipe"
echo "Fill $dst"
dd if=/dev/urandom of="$dst" bs=1048576 conv=sync || true
cat /dev/urandom > "$dst.1" || true
sync
ls -la "$dst" "$dst.1"
rm "$dst" "$dst.1"
done
} 2>&1 | tee -a wipe-free.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment