LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-14-2019, 10:54 PM   #1
Sol33t303
Member
 
Registered: Jul 2017
Distribution: gentoo
Posts: 115

Rep: Reputation: Disabled
Best recovery software for my situation?


So, I ended up accidentally DDing my drive since it's device file changed from /dev/sda to /dev/sdc since I booted my PC with my USB plugged in (yeah I know, I should have checked, I'll be more careful in the future). I was trying to turn my USB into a system rescue CD USB. Here is what I ended up running "dd if=/path/to/iso of=/dev/sdc status=progress" (/dev/sdc being my SSD)

I had two drives in my PC, 1 500 GB and 1 2 TB HDD. The SSD (the drive I burned the iso to) had two partitions (also, both drives were GPT)1 EFI system Partition, and one big LVM Physical volume. The HDD was just one LVM Physical volume. Both physical volumes were in 1 volume group, and 1 logical volume took up the entire volume group. The EFI partition seems unaffected, since I could get to rEFInd (a boot manager), and it could successfully boot my PC. And my logical volume was formatted as EXT4.

I know that when you have to recover things, it's best to touch it as little as possible. I didn't realised the mistake I had made, so I booted my PC, and realised what I had done. I tried activating my LVM volume, and it failed to activate (can't remember what exactly it said, not booting back into it to find out), I then powered off the computer and that is how it has stayed.

So, what I was wandering is what recovery software should I use? This is (luckily) the first time I have had to recover anything. There seems to be multiple software available for recovery (testdisk, ddrescue, photorec), so how should I choose which to use? Seeing as I screwed up using DD, DDrescue seems like the obvious one I should use, or are one of the others a better option?
 
Old 05-15-2019, 12:13 AM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
A couple of things:

1) You should always make sure that when using dd you KNOW that the drive you're targeting with it, IS the correct drive. NEVER assume it is the correct drive, you can check this with the lsblk command, which will give you a "tree like" view of the drives connected to your system.

2) As it says in my posting signature, if the data on said drive is important to you, particularly if you're thinking of using the dd command on it, you should ALWAYS have a backup in case you target the wrong drive.

3) The dd command works at a very low-level, so for example, if you dd'd the whole drive, then this would also wipe out the partitions on that drive as well as the data (files) on it. So there's every chance that data is lost forever.

I guess you could make a backup of the dd'd drive, then try one of the recovery tools you listed, and see if you can recover anything from it. I don't think there's any magic answer to your question though. Maybe ddrescue *might* recover something, but I suspect at least some of the data is most likely lost forever. Do you have a backup of that data before you dd'd the drive?
 
Old 05-15-2019, 12:33 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
If you can boot, you didn't trash the "system" disk (presumably the SSD), but probably the 2T disk.
All conjecture. Boot up any liveCD and follow the instructions in the post here. Then we'll have some idea of what's what.

At a minimum I would expect you have lost partition table, and whatever the size of the iso was at the start of the disk - but I've never tried this on a gpt, so guessing based on MBR experience. I prefer photorec for simple restore of any files it finds. You have some control - but none of the filenames will survive; that can be a serious PITA.
And on 2T to a USB rescue disk it will take a while - maybe days - before you can even start looking at the data found.
ddrescue will not be of benefit unless you want to "dd" the entire disk to work on a copy - not necessary IMHO, but note my sigline too ... :shrug:
 
Old 05-15-2019, 01:18 AM   #4
Sol33t303
Member
 
Registered: Jul 2017
Distribution: gentoo
Posts: 115

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
A couple of things:

1) You should always make sure that when using dd you KNOW that the drive you're targeting with it, IS the correct drive. NEVER assume it is the correct drive, you can check this with the lsblk command, which will give you a "tree like" view of the drives connected to your system.

2) As it says in my posting signature, if the data on said drive is important to you, particularly if you're thinking of using the dd command on it, you should ALWAYS have a backup in case you target the wrong drive.

3) The dd command works at a very low-level, so for example, if you dd'd the whole drive, then this would also wipe out the partitions on that drive as well as the data (files) on it. So there's every chance that data is lost forever.

I guess you could make a backup of the dd'd drive, then try one of the recovery tools you listed, and see if you can recover anything from it. I don't think there's any magic answer to your question though. Maybe ddrescue *might* recover something, but I suspect at least some of the data is most likely lost forever. Do you have a backup of that data before you dd'd the drive?
Quote:
Originally Posted by syg00 View Post
If you can boot, you didn't trash the "system" disk (presumably the SSD), but probably the 2T disk.
All conjecture. Boot up any liveCD and follow the instructions in the post here. Then we'll have some idea of what's what.

At a minimum I would expect you have lost partition table, and whatever the size of the iso was at the start of the disk - but I've never tried this on a gpt, so guessing based on MBR experience. I prefer photorec for simple restore of any files it finds. You have some control - but none of the filenames will survive; that can be a serious PITA.
And on 2T to a USB rescue disk it will take a while - maybe days - before you can even start looking at the data found.
ddrescue will not be of benefit unless you want to "dd" the entire disk to work on a copy - not necessary IMHO, but note my sigline too ... :shrug:
First off, I made a mistake in my post. I did this all probably 24 hours ago at night. It booted into GRUB, then that booted into my system. Not rEFInd (I didn't have grub installed on my system, so it's from the iso)
As for having a backup, unfortunatly I don't, the reason being that I don't have anything else that could hold 2.5 TBs worth of data, so there is nowhere I can backup to.
This also means I don't have any space anywhere to dd the disk to make a copy of it and work on it that way. So am I just RIP?
 
Old 05-15-2019, 01:22 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,837

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
the only way to restore anything is to make a copy of the dead data into a good/working partition/filesystem. This is the absolute minimal requirement. If you have no space you cannot recover. If your data is really important just buy a hdd to help to solve it.
 
Old 05-15-2019, 03:20 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Do as I suggested - you might be luckier than you realise.
 
Old 05-15-2019, 09:24 AM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,777

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by syg00 View Post
At a minimum I would expect you have lost partition table, and whatever the size of the iso was at the start of the disk - but I've never tried this on a gpt, so guessing based on MBR experience.
There is a backup copy of the GPT at the very end of the disk. A GPT partitioning tool will offer to recover that, so you can definitely restore the partitioning.

If this was not the system drive containing /etc/lvm/{archive,backup}, then you can also recover the LVM structure. Then you can determine which LVM LV and its filesystem have been damaged.
 
1 members found this post helpful.
  


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
[SOLVED] Old situation and New situation bkumar82 Linux - Newbie 2 01-28-2019 01:08 AM
I am seeking data recovery/rescue advice—and it's not a typical situation JMacSmith Linux - Hardware 10 06-22-2017 03:32 AM
Softraid (0) recovery situation peterlowrie Linux - Server 1 12-16-2011 06:40 PM
LXer: The Software Patents Situation and How It Affects Free Software LXer Syndicated Linux News 0 08-03-2008 04:11 AM
LXer: Linux Data Recovery on Windows - Is possible through Disk Doctors Linux Recovery Software LXer Syndicated Linux News 0 10-22-2006 12:21 PM

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

All times are GMT -5. The time now is 07:08 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