Recover files from your drive even if the drive file system is corrupt
Most files can be recovered from storage drives even it is deleted , but in some rare cases where the file system of the drive itself is corrupt then the data recovery becomes very difficult but not impossible .Consider a situation in which the memory card of your digital camera is corrupt and is unusable without being formatted , but if formatted all the precious pictures in it will be lost.In such extreme cases a little command line tool in Linux called magicrescue can be used. magicrescue can be used in cases where the drive’s filesystem or partition is completely corrupt or unusable and it can only be used to restore known file types such as images, mp3 etc .
If you are using ubuntu or any debian based Linux distribution ,install magicrescue by typing the following in terminal:
sudo apt-get install magicrescue
or else install it by using the distibution’s package manager.
After installing magicrescue connect your corrupted flash drive or memory card to the system , chances are that they do not get mounted due to corrupted filesystem . Find the hardware address of the drive ,for example if it is a flash drive the hardware address might be /dev/sdb or if it is a memory card you can find it in /dev/disk/by-id/ and will contain usb-card-reader or something like that, be careful not to select the wrong device.
magicrescue requires two mandatory options -d and -r. -d for specifying the output directory and -r to specify the recipe or the type of file to extract ,if multiple file types are to be extracted -r can be used successively.
For example if you want to extract jpeg files from the drive sdb ,the command to be used is:
sudo magicrescue -d ./Pictures/ -r jpeg-jfif -r jpeg-exif /dev/sdb
sudo is necessary because ordinary user cannot access the drive hardware directly and ./Pictures/ is the output directory and jpeg-jfif and jpeg-exif are jpeg filetypes and /dev/sdb is the drive from which the images are to be extracted.