LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   New to linux, trying to recover data on IDE hard drive (https://www.linuxquestions.org/questions/linux-newbie-8/new-to-linux-trying-to-recover-data-on-ide-hard-drive-4175664890/)

Linx_88 11-25-2019 01:47 PM

New to linux, trying to recover data on IDE hard drive
 
Hey everyone, I'm new here but I'm glad I'm finally learning some of the basics of using Linux. Initially I installed it on my PC using Virtual box but instead decided to use dual boot instead on a lesser laptop in case I get too deep and essentially drown.

Right, so I was informed that I can use Linux to recover data on a HDD that is corrupt instead of a program on Windows i.e. stellar data recovery. I'm excited to learn from taking the steps on different guides and what not, but I've ran into a mild road block.

The guide I followed told me to install smartmontools and testdisk, so I input the commands:

Sudo apt-get install smartmontools
And
Sudo apt-get install testdisk

They seem to have installed properly, though I don't know the entire functionality of smartmontools. Testdisk is pretty apparent from its name. While in terminal I next typed:

Sudo fdisk -l

And it gave me a bunch of disks.

Disk /dev/loop0
Disk /dev/loop1
Disk /dev/loop2
Etc.

I'm not sure what each of these "loops" are referring to, could someone fill me in? I could assume they are referring to the structure of the HDD, reserving the space for system files causing a 500gb HDD be only a 465gb HDD.

Regardless, I've gotten a little sidetracked and here is the error I ran into. I am attempting to mount a recover data from a corrupt 250gb IDE HDD, WD Scorpio Blue. I am able to see the disk mounted reading:

Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0ed70dad

Which is awesome (I think), I've identified the hard drive which shows unallocated space on disk mgmt in Windows. P.s. stellar data recovery didn't really work well at all.

So as for this error I've been leading up to, the next command I typed in and what it told me is this:

Sudo smartctl -i /dev/sdb

/dev/sdb: Unknown USB bridge [0x0930:0xa002 (0x103)]
Please specify the type with the -d option

I went into Google and typed "Unknown USB Bridge Linux smartmontools" and it gave me a list of recognized and unrecognized USB bridges. I am actually using 2 adapters, one is converting the IDE into SATA and the next one is from an external HDD I bought around 2006 giving it USB capability. Neither of which I (obviously) noticed on the list of recognized bridges. So I am looking to find what USB bridge would be recognizable for this application, and any other tidbits of information you can fill me in on.

Though I am new to Linux, my journey has just begun. Thanks!

smallpond 11-25-2019 04:06 PM

loop devices are not physical disks. They are images loaded into memory.

There are two ways to specify data sizes. 1KB = 1000 bytes in Scientific units. 1KiB (note the i) = 1024 in programmer shorthand, although this form is conventionally used for referring to memory rather than disk. So your 250 GB disk is also 232.9 GiB.

The USB error is weird. I've never heard of an unsupported bridge. Can you post the output of lsusb?

syg00 11-25-2019 04:14 PM

This is diving in the deep end - you will trip over lots of "basic" things trying to do a complex thing, the recovery. First up, LQ supports [code] tags for readability - use them and copy/paste command output so we can read them.
[code]output
goes
here[/code] looks like this:
Code:

output
 goes
here

Now, to your questions:
- Linux has a help system called man, so man loop will tell what a loop device is (use q to quit any manpage). Basically you can ignore them, and no, they are not eating your disk space. That's another misunderstanding for another time maybe.
- why are you using the IDE to SATA converter ?. If the external disk has direct USB use that alone. I have a bunch of old IDE disks I play with via a caddie and never have any issues - not that I recall using smartmon on them too often.
- testdisk is best for recovering deleted partitions, not really data recovery. What are you after - the entire disk, or simply some files of interest ?.

Linx_88 11-25-2019 06:31 PM

I do understand this is going to be a rather complicated process, and I have very little experience even using MS-DOS, though I have had many Android phones and rooted them with different programs, sometimes having to use cmd in windows.

The video I am using is by quidsup and here is the link https://www.youtube.com/watch?v=d1_rMHuUBOc

Quote:

Originally Posted by smallpond (Post 6061773)
The USB error is weird. I've never heard of an unsupported bridge. Can you post the output of lsusb?

Here is the output of lsusb in terminal. I will try to use the reference here but it might fail.

[code]Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0930:0227 Toshiba Corp.
Bus 001 Device 003: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 002: ID 04f2:b446 Chicony Electronics Co., Ltd
Bus 001 Device 006: ID 0930:a002 Toshiba Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub[\code]

Let me know if that helps.

https://www.smartmontools.org/wiki/Supported_USB-Devices

That is the page I landed on when trying to figure out why terminal was saying "Unknown USB bridge"


Quote:

Originally Posted by syg00 (Post 6061777)
This is diving in the deep end - you will trip over lots of "basic" things trying to do a complex thing, the recovery. First up, LQ supports [code] tags for readability - use them and copy/paste command output so we can read them.
[code]output
goes
here[/code]

Now, to your questions:
- Linux has a help system called man, so man loop will tell what a loop device is (use q to quit any manpage). Basically you can ignore them, and no, they are not eating your disk space. That's another misunderstanding for another time maybe.
- why are you using the IDE to SATA converter ?. If the external disk has direct USB use that alone. I have a bunch of old IDE disks I play with via a caddie and never have any issues - not that I recall using smartmon on them too often.
- testdisk is best for recovering deleted partitions, not really data recovery. What are you after - the entire disk, or simply some files of interest ?.

That man is a useful feature and I am sure I'll be using it more as I go along.

The reason I am using an IDE to SATA is because I have multiple SATA connectors from external HDD I purchased in the past which has enabled me to mount any SATA HDD I have via USB. It hasn't been a problem before since I've only worked with SATA. Now, perhaps it is the time to purchase a caddie.

I used test disk as it is what is mentioned step by step in the aforementioned video. The HDD I have is from my deceased brother's laptop which was apparently destroyed at or around his time of death to cover the contents of it up. The screen was cracked and the laptop wouldn't boot. The HDD could have been encrypted(?), no damage was noticed to the body of the laptop so the HDD good. As far as the possibility of encryption is considered, one of the few files that Stellar Toolkit Data Recovery could pull on on Windows was a PDF regarding Apollo Client encryption. So to answer your question with a long, drawn out Users/(username)/Desktop../Documents../Downloads or just C:/ if possible.

jefro 11-25-2019 07:28 PM

I don't get the smart tools part. Why do you care about that just yet? I'd try to recover the files before it gets any worse.

Testdisk/photorec are on live media of all sorts. Boot to the live media and select your damaged drive to try to recover.

https://www.smartmontools.org/wiki/S...ed_USB-Devices

mrmazda 11-25-2019 07:42 PM

Quote:

Originally Posted by Linx_88 (Post 6061808)
"Unknown USB bridge"
...
The reason I am using an IDE to SATA is because I have multiple SATA connectors from external HDD I purchased in the past which has enabled me to mount any SATA HDD I have via USB. It hasn't been a problem before since I've only worked with SATA. Now, perhaps it is the time to purchase a caddie.

IME, the double adaptation is the source of the error message. You probably need either a better quality PATA to SATA converter, or a "caddie" that skips the conversion from the PATA bus to the SATA bus, going instead directly from PATA to USB. USB is a serial bus, as is SATA, while PATA is a parallel bus. Serial to serial conversion is less troublesome. Determining the manufacturer of the bridge employed in a particular caddie can be problematic. I imagine most of us to find one that is compatible do it via trial and error. Having a PC with PATA ports could make the recovery process easier. 32 bits is adequate to the task.

syg00 11-25-2019 08:43 PM

Plug the disk in and run this.
Code:

lsblk -f

cordx 11-25-2019 09:11 PM

Quote:

Originally Posted by Linx_88 (Post 6061732)
Sudo smartctl -i /dev/sdb

/dev/sdb: Unknown USB bridge [0x0930:0xa002 (0x103)]
Please specify the type with the -d option

i agree with jefro that recovering the data sounds like it should be the main focus. if you really feel the disk might be failing, asking smartmontools to run tests on it might not be the best idea.

my external drives (wd my passport ultra and oyen digi enclosure with bare drive inside) give this same "please specify" output. they both just needed a -d sat added to the end of sudo smartctl -i /dev/sdX.

so mine ended up being
sudo smartctl -i /dev/sdb -d sat

if you scroll the list on the site you linked, it looks like 75% or so can use -d sat.

man smartctl has a -d subsection that says:
Quote:

sat [,auto][,N] - the device type is SCSI to ATA Translation (SAT). This is for ATA disks that have a SCSI to ATA Translation (SAT) Layer (SATL) between the disk and the operating system. SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and the other 16 bytes long. The default is the 16 byte variant which can be overridden with either ´-d sat,12´ or ´-d sat,16´.

If ´-d sat,auto´ is specified, device type SAT (for ATA/SATA disks) is only used if the SCSI INQUIRY data reports a SATL (VENDOR: "ATA "). Otherwise device type SCSI (for SCSI/SAS disks) is used.

Linx_88 11-25-2019 11:29 PM

Quote:

Originally Posted by jefro (Post 6061820)
I don't get the smart tools part. Why do you care about that just yet? I'd try to recover the files before it gets any worse.

Testdisk/photorec are on live media of all sorts. Boot to the live media and select your damaged drive to try to recover.

https://www.smartmontools.org/wiki/S...ed_USB-Devices

I'm glad you've told me this. The reason I started using smartmontools is from the link i posted on youtube. Someone is recovering files from a 'seriously corrupted hard drive,' wouldn't think twice of it being something that could make it worse. I am very new to all of this and I'm not sure what the capabilities of testdisk and photorec are, though I'd assume photorec is to recover images. My main goal here is to copy the files on this hard drive to one that can be mounted in Windows, or at least view them in Linux. Anything else is just amateur hour for me.



Quote:

Originally Posted by mrmazda (Post 6061830)
IME, the double adaptation is the source of the error message. You probably need either a better quality PATA to SATA converter, or a "caddie" that skips the conversion from the PATA bus to the SATA bus, going instead directly from PATA to USB. USB is a serial bus, as is SATA, while PATA is a parallel bus. Serial to serial conversion is less troublesome. Determining the manufacturer of the bridge employed in a particular caddie can be problematic. I imagine most of us to find one that is compatible do it via trial and error. Having a PC with PATA ports could make the recovery process easier. 32 bits is adequate to the task.

This is some good info. It took me a minute to understand it but I can see what you mean about the PATA to SATA, and had my suspicions about the double adaptation. That's where I basically stand with my problem, which one should I buy. I don't do this often, though a good docking station is something I lack. Also, I do have a relatively good PC, but I just checked the bag of goodies that came with it and I didn't see anything relative to a PATA connection, or 40 pin IDE. I did see a 4 pin power cable, but that's it. I am trying to relatively cost effective though as funds are limited ATM. So I may just have to take 5 on this project and do my homework on the Linux tutorials on the web instead.



Quote:

Originally Posted by syg00 (Post 6061839)
Plug the disk in and run this.
Code:

lsblk -f

This is what it says.

Code:

lsblk -f
NAME  FSTYPE  LABEL      UUID                                MOUNTPOINT
loop0  squashf                                                  /snap/gnome-3-28
loop1  squashf                                                  /snap/gnome-char
loop2  squashf                                                  /snap/gnome-char
loop3  squashf                                                  /snap/gnome-calc
loop4  squashf                                                  /snap/gnome-logs
loop5  squashf                                                  /snap/gtk-common
loop6  squashf                                                  /snap/core/8039
loop7  squashf                                                  /snap/gnome-logs
loop8  squashf                                                  /snap/core18/106
loop9  squashf                                                  /snap/core/7270
loop10 squashf                                                  /snap/gnome-syst
loop11 squashf                                                  /snap/gnome-calc
loop12 squashf                                                  /snap/gnome-syst
loop13 squashf                                                  /snap/gnome-3-28
loop14 squashf                                                  /snap/gtk-common
loop15 squashf                                                  /snap/core18/126
sda                                                           
├─sda1 ntfs    System      E8A282B1A2828432                   
├─sda2 vfat                FC83-E08D                            /boot/efi
├─sda3 ntfs                0A04855604854623                   
├─sda4 ntfs    TI10700000B A67610D97610AC55                   
├─sda5 ntfs                D4AA0A69AA0A4886                   
├─sda6 ntfs    Recovery    1C109A061099E754                   
└─sda7 ext4                b45ae981-2b1f-42bb-96ef-b86eef2040be /
sdb

I can clearly see that sda7 ext4 is reading the hard drive, but I'm not sure why the UUID is so much longer. Maybe because of the double adaptation, or because it's PATA. Hopefully this can help.



Quote:

Originally Posted by cordx (Post 6061845)
i agree with jefro that recovering the data sounds like it should be the main focus. if you really feel the disk might be failing, asking smartmontools to run tests on it might not be the best idea.

my external drives (wd my passport ultra and oyen digi enclosure with bare drive inside) give this same "please specify" output. they both just needed a -d sat added to the end of sudo smartctl -i /dev/sdX.

so mine ended up being
sudo smartctl -i /dev/sdb -d sat

if you scroll the list on the site you linked, it looks like 75% or so can use -d sat.

man smartctl has a -d subsection that says:

There's a lot of good stuff in your response. I don't plan to go any further with this smartmontool running tests if it could potentially cause more errors. Though I am curious about which of -a, -l, -x, -xall, --scan, or --scan-open might cause an error. I'll wait to explore these and learn more to after I've tried to backup and/or restore the data to another, empty hdd. That is the main command/process I'm interested in learning for now.

Thanks everyone.

syg00 11-25-2019 11:49 PM

Don't worry about /dev/sda - you're booted from that disk. As for the UUID, just ignore them all. The ext4 one is valid, the NTFS and VFAT ones are pseudo-UUIDs.
So the dodgy device is recognised (as the fdisk also shows above), but has no discernable filesystem that Linux will handle. What does this generate ?.
Code:

dmesg | grep -i sdb

cordx 11-26-2019 03:34 AM

Quote:

Originally Posted by Linx_88 (Post 6061880)
There's a lot of good stuff in your response. I don't plan to go any further with this smartmontool running tests if it could potentially cause more errors. Though I am curious about which of -a, -l, -x, -xall, --scan, or --scan-open might cause an error. I'll wait to explore these and learn more to

it isn't a matter of smartmontools causing any kind of an error as much as potentially exacerbating any existing problem that might be on the disk to begin with. a quick test usually takes just a few minutes, but may not tell you if the disk is actually failing. the long test can take well over 30 minutes for an hdd and the extra time it spends interacting with that disk may be time you no longer have to access the data if it is indeed failing. it is a matter of prioritizing the unknown amount of time you have left.

since your primary goal is data retrieval, there is little that smartmontools can do to help in that endeavor. after you recover what you are looking for, smartmontools should be able to give you a decent idea of whether or not the disk is healthy enough to use for some other purpose.

Quote:

Originally Posted by Linx_88 (Post 6061880)
after I've tried to backup and/or restore the data to another, empty hdd. That is the main command/process I'm interested in learning for now.

this definitely sounds like a good place to start. hopefully you can get what you need and decide what to do with the disk itself after that process is complete :)

kilgoretrout 11-26-2019 07:57 AM

This is what you probably need if you have a usb3 port to plug into:

https://www.amazon.com/Vantec-SATA-I...s%2C183&sr=8-5

If you're plugging into usb2, you need an adapter with a separate power supply like this one:

https://www.amazon.com/AGPtek-Drive-...WM1T5KD2M7Y6VY

I've always had one of these in my toolbox and they come in very handy.

fatmac 11-26-2019 08:34 AM

Basically.
Boot a 'live' pendrive, plug in your IDE drive, use
Code:

dmesg|tail
to check what the system says it is, likely /dev/sdb.
Mount /dev/sdb by partition number,
Code:

sudo mount /dev/sdb1 /mnt
your files should be seen by issuing
Code:

ls /mnt
in the terminal.
Copy your files to backup media.

Linx_88 11-26-2019 09:38 AM

Quote:

Originally Posted by syg00 (Post 6061884)
Don't worry about /dev/sda - you're booted from that disk. As for the UUID, just ignore them all. The ext4 one is valid, the NTFS and VFAT ones are pseudo-UUIDs.
So the dodgy device is recognised (as the fdisk also shows above), but has no discernable filesystem that Linux will handle. What does this generate ?.
Code:

dmesg | grep -i sdb

Code:

[sdb] 488397168 512-byte logical blocks: (250 GB/233 GiB)
[ 1100.565882] sd 2:0:0:0: [sdb] Write Protect is off
[ 1100.565886] sd 2:0:0:0: [sdb] Mode Sense: 38 00 00 00
[ 1100.568682] sd 2:0:0:0: [sdb] No Caching mode page found
[ 1100.568688] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 1100.618128]  sdb:
[ 1100.623528] sd 2:0:0:0: [sdb] Attached SCSI disk

"What does it all mean"

-me, lol.

Joking, but I'm not sure what you mean by Linux cant handle this filesystem

Hopefully some good news.



Quote:

Originally Posted by cordx (Post 6061930)
it isn't a matter of smartmontools causing any kind of an error as much as potentially exacerbating any existing problem that might be on the disk to begin with. a quick test usually takes just a few minutes, but may not tell you if the disk is actually failing. the long test can take well over 30 minutes for an hdd and the extra time it spends interacting with that disk may be time you no longer have to access the data if it is indeed failing. it is a matter of prioritizing the unknown amount of time you have left.

since your primary goal is data retrieval, there is little that smartmontools can do to help in that endeavor. after you recover what you are looking for, smartmontools should be able to give you a decent idea of whether or not the disk is healthy enough to use for some other purpose.



this definitely sounds like a good place to start. hopefully you can get what you need and decide what to do with the disk itself after that process is complete :)

Thanks for your help. I don't think the HDD is too damaged, given there was no physical damage to the body of the laptop and no signs of water entry. Though I won't test it. Hopefully I can get it transferred.




Quote:

Originally Posted by kilgoretrout (Post 6061987)
This is what you probably need if you have a usb3 port to plug into:

https://www.amazon.com/Vantec-SATA-I...s%2C183&sr=8-5

If you're plugging into usb2, you need an adapter with a separate power supply like this one:

https://www.amazon.com/AGPtek-Drive-...WM1T5KD2M7Y6VY

I've always had one of these in my toolbox and they come in very handy.

I do have a an option of both, so I'll be purchasing the Vantec USB3 one as soon as my broke ass can afford it lol. Maybe I won't have to buy it quite yet, though like you mentioned, I'd like to have it in my toolbox as well.



Quote:

Originally Posted by fatmac (Post 6061998)
Basically.
Boot a 'live' pendrive, plug in your IDE drive, use
Code:

dmesg|tail
to check what the system says it is, likely /dev/sdb.
Mount /dev/sdb by partition number,
Code:

sudo mount /dev/sdb1 /mnt
your files should be seen by issuing
Code:

ls /mnt
in the terminal.
Copy your files to backup media.

I will try this method soon, after I have replied to this considering I've already written a response to the others. Though do you think that running it from a live pendrive (which I assume is the same .ISO I used initially to install Ubuntu, just boot it from the pendrive) would override the limitation likely set forth from the dual adaptation I have set up? Also, what command would you suggest using to mount the /dev/sdb? I'm assuming sda7 notates the partition number from the "lsblk -f" command I entered before? Pardon my n00bishn3ss >.>

*EDIT:
I am not booted from the pendrive and this is what typing
Code:

dmesg|tail
yields

Code:

ubuntu@ubuntu:~$ dmesg|tail
[  303.686391] audit: type=1400 audit(1574783109.187:235): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.core.hook.configure" pid=3478 comm="apparmor_parser"
[  305.673771] audit: type=1400 audit(1574783111.175:236): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.gnome-system-monitor.gnome-system-monitor" pid=3486 comm="apparmor_parser"
[  310.632083] audit: type=1400 audit(1574783116.135:237): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.gnome-system-monitor" pid=3485 comm="apparmor_parser"
[  352.418914] wlp2s0: authenticate with d8:0d:27:72:78:ff
[  352.440664] wlp2s0: send auth to d8:0d:27:72:78:ff (try 1/3)
[  352.443805] wlp2s0: authenticated
[  352.454664] wlp2s0: associate with d8:0d:27:72:78:ff (try 1/3)
[  352.458857] wlp2s0: RX AssocResp from d8:0d:27:72:78:ff (capab=0x1431 status=0 aid=2)
[  352.458979] wlp2s0: associated
[  352.563320] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready

For the next command
Code:

sudo mount /dev/sdb1 /mnt
Nothing worked but I assume because the wrong partition number was used.

beachboy2 11-26-2019 10:11 AM

Linx_88,

I have an IOMAX USB to SATA/IDE adapter and it works fine on the very rare occasion I need to use it.

I have no wish to knock kilgoretrout's recommendation for the above two items, it is sensible advice.

However, do look at the Amazon one star customer feedback for those particular items which includes references to fried drives and data loss.

fatmac's suggestion is the safer one, plus you don't need to lay out cash on new hardware.

Just a thought.


All times are GMT -5. The time now is 10:36 AM.