[SOLVED] How to recover deleted files from a fat32 volume in Linux?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to recover deleted files from a fat32 volume in Linux?
Hi all.
I accidentally deleted some precious files from an external disk formatted as fat32. I immediately unmounted the volume. Is there a way in linux (I've not a windows system at hand now) to recover the deleted files?
Thank you.
Code:
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe8900690
Device Boot Start End Blocks Id System
/dev/sdb1 1 121601 976760001 c W95 FAT32 (LBA)
If they're really precious, the first thing I'd do is mount /dev/sdb1 as read-only.
Then image it dd if=/dev/sdb1 of=myimage
Then unmount /dev/sdb1 and unplug it.
Now mount myimage with the loop option, and then you can safely use photorec and all the other utilities to your heart's content, happy in the knowledge that if you mess up, you still have your original disk, untouched.
@syg00 - I launched photorec and it already found ~ 200 files of about 630. Estimated time left: about 11 hours. I will see tomorrow the complete results.
@tredegar - Good advice. Unfortunately I could not mirror the whole disk, because I don't have another Terabyte available. I just mounted the partition as read-only.
I didn't do anything with the disk, I immediately unmounted it. Now the estimated time left is 12h25m. I'm checking the recovered files and it looks like it's doing a good job. Since I'm not in a hurry, I prefer to leave it running (it's 16:00 now in Italy, tomorrow early in the morning it should have finished). Thank you, anyway.
Let it be known that photorec = testdisk ... they are one and the same, and I wish they would just stick with one name.
TestDisk and PhotoRec are in one package, are both free and Open Source software and are licensed under the terms of the GNU Public License.
TestDisk is data recovery software which is designed to help recover lost partitions and make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error.
PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from Hard Disks and CDRom and lost pictures from digital camera memory.
TestDisk can:
Fix partition table, recover deleted partition
Recover FAT32 boot sector from its backup
Rebuild FAT12/FAT16/FAT32 boot sector
Fix FAT tables
Rebuild NTFS boot sector
Recover NTFS boot sector from its backup
Fix MFT using MFT mirror
Locate ext2/ext3 Backup SuperBlock
Undelete files from FAT, NTFS and ext2 file system
Copy files from deleted FAT, NTFS and ext2/ext3 partitions.
PhotoRec is a companion program to TestDisk.
For more safety, PhotoRec uses read-only access to handle the drive or memory support you are about to recover lost data from.
PhotoRec works with HardDisks, Cdrom, memory card (Compact Flash, Memory Stick, SecureDigital/SD, SmartMedia, Microdrive, MMC…), USB Memory Drives, DD raw image, EnCase E01 image… PhotoRec has been successfully tested with various portable media players including iPod and Digital Camera.
Hi. Photorec finished the job and the result is excellent! About 95% of the lost files has been recovered. You saved my day!
@alan_ri and H_TeXMeX_H: thank you for the clarification about testdisk and photorec. Indeed the two packages are strictly related: I installed photorec using Yast in Opensuse and it installed testdisk as a requirement.
If they're really precious, the first thing I'd do is mount /dev/sdb1 as read-only.
Then image it dd if=/dev/sdb1 of=myimage
Then unmount /dev/sdb1 and unplug it.
You wouldn't do a mount to use dd. In fact, not mounting (even read-only) is the only way to ensure, data is NOT modified.
I created an account just so I could thank the people who recommended PhotoRec. I used too wide a wildcard spec when deleting old photos and wiped my entire camera card before copying it off to permanent storage. I haven't been this excited since Papa Murphy's announced $10 Tuesday 3-topping large pizzas.
Note to future visitors: If you get here like I did by searching for "recover lost photos fat32", go right now and install PhotoRec. When you get back all those lost files, be sure and donate generously.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.