Skip to content

Instantly share code, notes, and snippets.

@turicas
Created May 4, 2023 03:51
Show Gist options
  • Save turicas/a3ebfb14f08e97d1cf6d527f8d79da49 to your computer and use it in GitHub Desktop.
Save turicas/a3ebfb14f08e97d1cf6d527f8d79da49 to your computer and use it in GitHub Desktop.
Copy all the possible files from a failing disk (I/O error)
#!/bin/bash
# XXX: replace /dev/sdb1 with the partition you'd like to rescue
sudo apt update && sudo apt install -y gddrescue
sudo time ddrescue /dev/sdb1 /path/to/file.raw /path/to/ddrescue.log --try-again --force --verbose
sudo mkdir -p /mnt/rescued
sudo mount -o ro,loop /path/to/file.raw /mnt/rescued
cd /mnt/rescued # enjoy :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment