LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 06-17-2020, 01:17 AM   #1
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Rep: Reputation: 85
Unhappy Recovering 2 drives with all files deleted


I was messing around in the KDE settings when I noticed that my windows borders were changing, and I didn't change them. I went to change them back and noticed that all but 2 themes were gone. I started switching between windows seeing if they were all changed, and my system was becoming sluggish. I thought maybe this was a problem that a reboot would fix or a login and logout would fix. My system had become too sluggish to reboot it anytime soon so I did a alt+sys req REISUB.


Now I had a new strange problem. My computer wasn't booting Linux. It would try to boot from the usb drive or anything but Linux. I have Slackware with KDE on my usb drive as a live system. I booted it up and discovered that all of my files from 2 drives had been wiped except for very few that might have been in my ram and written to disk right before I issued the reboot.


I suspect it was a buggy script that could have caused it. The important thing for right now is not what caused it but can it be recovered. How much of it can be recovered? I can tell this is not the result of a faulty drive or a reformat. The filesystems on both drives are perfectly intact. There's a bunch of free space that wasn't there before. I've been mounting the drives with read-only and have not written anything to disk.


One drive is a 1 terabyte that was formatted as NTFS because Windows had to be able to access it too. The other drive is is a 200-300 gb SSD with ext4.


I'm about to try photorec. What else do I need to know about recovering the files besides don't write anything new to the disks? How much of it can be recovered? What's the chances of doing a successful recovery? Is there anything besides photorec I should be using?
 
Old 06-17-2020, 01:34 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I use photorec - but not for system files, especially Windoze. Handles NTFS fine. coupla warnings;
- you need to make sure you have a separate target/recovery disk, and ensure photorec is pointed to it.
- you lose all filenames. Can be a PITA, but it is what it is.

Forgot to mention, you can narrow the files that need to be scanned for - so in my case I only care about photos. Saves work later. Oh, and it will take a while - maybe days.

Last edited by syg00; 06-17-2020 at 01:37 AM. Reason: forgot to ...
 
Old 06-17-2020, 03:03 AM   #3
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 21 MATE, EndeavourOS, antiX, MX Linux
Posts: 3,972
Blog Entries: 32

Rep: Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465
fakie_flip,

I can recommend diskdigger for both Linux and Windows:
https://diskdigger.org/

https://www.techrepublic.com/blog/wi...th-diskdigger/

Note that the free version recovers files one at a time and takes forever, so I advise spending $14.99 on the paid version which is much faster.

Nevertheless it will still take a while on large capacity drives, but it does work.

Last edited by beachboy2; 06-17-2020 at 03:06 AM.
 
1 members found this post helpful.
Old 06-17-2020, 04:09 AM   #4
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by fakie_flip View Post
The important thing for right now is not what caused it but can it be recovered.
The important thing is definitely "what caused it".
The more info you can provide,the more likely you are to take the correct steps to recover.

Otherwise, yeah, flail about with photorec and see what you can find.
 
1 members found this post helpful.
Old 06-17-2020, 06:02 AM   #5
remmilou
Member
 
Registered: Mar 2010
Location: Amsterdam
Distribution: MX Linux (21)/ XFCE
Posts: 211

Rep: Reputation: 69
Quote:
Originally Posted by descendant_command View Post
The important thing is definitely "what caused it".
The more info you can provide,the more likely you are to take the correct steps to recover.

Otherwise, yeah, flail about with photorec and see what you can find.
Completely agree.
I've been in computer forensics for a long time now. My advice:
  • Do not even power on your SSD, before you are going to execute a carefully planned action.
    A trim on on this SSD and you will not be able to recover deleted files.
    Best steps, assuming your drives are not encrypted:

    Take out both drives and make dcfldd (much better than dd) images (or another forensically sound format, like EWF), to a large enough drive.
    Be sure to mount the drives READ ONLY (will not protect you against firmware induced trim).
    It's very OK, to use a Windows pc for this and use FTK-Imager (free!) FTK_Imager will show you lots of usefull information about your drive, and deleted files. It's one of my favorite Windows forensics tools.
    Then run Photorec on the images and not on the drives itself. You will be missing file names, so it probaly leaves you with a big puzzle. restorung a running system this way will be a PITA. Getting back user files is more likely.
    In Photorec limit the mime-types to look for as much as possible, for the best results. By working on the images, you can play with this settings to find the optimum. Probably the best to start with lookin in "free space" on the FS only and not "whole disk". Your mileage may vary.
    Keep the drives as they are, if you can afford it.
    If you really want to use your own pc:

    Boot from a forensically sound Linux distro. Paladin is probably best of breed for this job.
    Attach a larg enough drive to create the images on.
    Paladin includes Photorec
And then...? Root cause analysis! You really have to find out what happened. Use the images for that.
Mount the images
Check for root kits and other malware.
Look for suspicious files.
Compare with a fresh install...

You will learn a lot about your system!!!
 
2 members found this post helpful.
Old 06-17-2020, 07:24 AM   #6
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,493

Rep: Reputation: Disabled
Use your backups to restore them.....you do have backups, don't you(?).
 
Old 06-18-2020, 03:34 AM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Try Testdisk, if you will have some luck.
https://www.cgsecurity.org/wiki/TestDisk_Download
 
Old 06-19-2020, 07:43 AM   #8
remmilou
Member
 
Registered: Mar 2010
Location: Amsterdam
Distribution: MX Linux (21)/ XFCE
Posts: 211

Rep: Reputation: 69
Quote:
Originally Posted by JJJCR View Post
Try Testdisk, if you will have some luck.
https://www.cgsecurity.org/wiki/TestDisk_Download
Photorec is part of testdisk.
See my earlier quote on how to operate in a sound way.
I consider "Try Testdisk" as an advice that may do more harm then good.
 
Old 06-19-2020, 07:50 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Possibly not.
Different tools for different purposes. Perhaps you too are not the embodiment of all knowledge.
 
Old 06-20-2020, 01:32 AM   #10
remmilou
Member
 
Registered: Mar 2010
Location: Amsterdam
Distribution: MX Linux (21)/ XFCE
Posts: 211

Rep: Reputation: 69
Quote:
Originally Posted by syg00 View Post
Possibly not.
Not what?
Quote:
Different tools for different purposes.
Strategy in the first place. Tools in the second.
Quote:
Perhaps you too are not the embodiment of all knowledge.
Not perhaps, but certainly.
As you can read, I gave an advice, not the ultimate solution.
If you can tell me what's wrong with my advice, I can learn from that.
 
1 members found this post helpful.
Old 06-20-2020, 10:50 AM   #11
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by syg00 View Post
- you lose all filenames. Can be a PITA, but it is what it is.
Wow. I would have thought that nobody would ever want to reinvent RECOVER.EXE. (I've was fortunate enough, back in the day, to never have been so desperate to have to use it to recover from a real problem.) I cringe at the thought of running such a tool on a terabyte of data files.

Oh the potential for damage that can result when a script run from, we can only assume given the extent of the file clobbering, the root account goes awry. Hopefully, there are recent backups.
 
Old 06-21-2020, 03:12 PM   #12
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Original Poster
Rep: Reputation: 85
How much space do I need for recovering 1 terabyte hdd + 300 gb hdd? Do I need identical amount of space?
 
Old 06-22-2020, 02:40 AM   #13
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by fakie_flip View Post
How much space do I need for recovering 1 terabyte hdd + 300 gb hdd? Do I need identical amount of space?
Ideally you should clone the problematic drive to a secondary location first and work on that, so you'd need more than that.
If you don't do that you need at least as much extra space as all the data you want to recover, but keep in mind that photorec will always recover much more than that.
So, best case scenario, you need 2 extra TB for that 1TB drive only.
 
Old 06-23-2020, 06:54 AM   #14
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Original Poster
Rep: Reputation: 85
Quote:
Originally Posted by ondoho View Post
Ideally you should clone the problematic drive to a secondary location first and work on that, so you'd need more than that.
If you don't do that you need at least as much extra space as all the data you want to recover, but keep in mind that photorec will always recover much more than that.
So, best case scenario, you need 2 extra TB for that 1TB drive only.

I'm looking at possibly buying this drive for the recovery.


https://www.newegg.com/black-seagate...82E16822184784


Other than using it for recovery, it would primary be used for storage, so I think the slower speed is OK for that because it looks like a great bang for the buck and Seagate should be higher quality than the el-cheapo off-brand chinese drive I found.
 
Old 06-24-2020, 02:08 AM   #15
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
FWIW, I did something similar a while ago - bought extra storage to be able to properly restore lost data.
Since I had to establish a backup scheme anyhow (lesson learned!) it was just a matter of course.

If you are 100% sure that
  • you will use the drive in read-only only
  • it has no hardware problems
then, IMO, you can skip the cloning of the drive.
But beware: testdisk can do some read/write operations.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Frontend for recovering deleted files from ext3 filesystem jayakrishnan Linux - General 3 12-16-2004 02:21 PM
problem in recovering deleted files bad magic number anamika123 Linux - General 1 09-19-2004 02:09 PM
recovering deleted files in cd bake oven icyfire Linux - Software 4 06-24-2004 03:34 PM
Recovering Deleted Files Brian of Gep Linux - Newbie 1 03-02-2004 02:26 AM
Need Help Fast...recovering Deleted Files dowdnt Linux - General 1 07-09-2003 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration