Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
After doing rm on a file in ext3, or shift+delete in Ubuntu, how can I get the file back? After a Google search I am finding a lot of expensive data recovery software, but it isn't worth the money.
The only issue with photorec and testdisk (both are great tools for failed systems though where you're just desperate to get anything back) is that you will recover all files of a type and then weed through the results to find what you're looking for. If you have thousands of photos, for example, this can be very labor intensive and disk space intensive.
You could try running command: photorec from a live CD. It is part of the testdisk package but you don't want to install it in the system that you lost the file in, as a matter of fact, you would want to reduce the amount you use the file system containing your lost file as much as possible to avoid overwriting it.
If the file is intact and still there, photorec will recover it. If it is still there but fragmented, you may still be able to recover it but this requires allot of studying and using sleuthkit along with photorec.
Sleuthkit can tell you exactly where the file's inode is.
A forensics live CD will have all these data recovery tools. Try the Helix Live CD.
As root, the example command below should show all deleted files using sleuthkit and their inode # and directory. Although I have not tried it on ext3 file system personally.
Code:
fls -rd /dev/sda1 | less
d/d * 232: /TEMP-823450
r/d * 293: /TEMP-131100
The “d/d” follows the format of directory entry value type value
and the second letter is the type according to the inode. The “d”
stands for directory, and the “r” stands for file. In most instances,
these should match. However, in the case of deleted files where the inode has been reallocated, it will not.
The asterisk “*” shows that it is deleted. The number following is the inode number.
After this is the full path of the deleted files.
If you figure out where your deleted file is, and you know it's size more or less, you can use dd to extract an image of that section of the file system and work on the image to recover the file and continue using the OS. It is advised to make an image of the entire block containing the file in case it is fragmented. It is not usual for a file to be written to more than one block unless it's size exceeds that of the block size.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.