In this example we will go through the steps to rescue data from a USB stick that contains a VFAT file system.
In general create a copy of the media you try to restore data from. Experimenting with the copy is safer than with the only original.
ddrescue which is a more robust version of
dd that keeps on going in case of errors.
apt install ddrescue testdisk
/devfile system (e.g.
RESDIR=~/rescue RESFILE="$RESDIR"/usbkey_rescue.img mkdir "$RESDIR" ddrescue /dev/sdf1 "$RESFILE" testdisk "$RESFILE"
If the file system is intact (or after a successful repair), you can mount the image via the loop device:
mount -o loop -t vfat "$RESFILE" /mnt