Page 1 of 2

hard drive recovery

Posted: Tue Oct 16, 2007 12:53 pm
by Usacomp2k3
So the old hard drive in my server died, but I'd like to try to recover some of the data that is on there, especially thy mysql database. Fortunately most of my real data was stored on the new drive which was mounted as a separate folder, but it's some of the system data that would be helpful.

The drive is a 40gb Maxtor Fireball 3, originally Apple branded (I'm pretty sure that's why it died :wink:). It had the /swap and the system drive, which was ext2 formatted.

So yeah, any recommendations for recovery tools that can read ext2?

Posted: Tue Oct 16, 2007 1:07 pm
by computron9000
What do you mean by "died"?

Posted: Tue Oct 16, 2007 1:14 pm
by Usacomp2k3
computron9000 wrote:
What do you mean by "died"?

Some random clicky. Filesystem is busted as Ubuntu liveCD can tell what size it is, but can't read any partitions.

Posted: Tue Oct 16, 2007 1:28 pm
by gerbilspy
I've read that Spinrite works well...haven't had to use it yet, though! :)

http://www.grc.com/sroverview.htm

Posted: Tue Oct 16, 2007 1:39 pm
by Usacomp2k3
Actually just got a copy of Spinrite burned and am going to try it now. Good timing :lol:

Posted: Tue Oct 16, 2007 2:45 pm
by gerbilspy
Usacomp2k3 wrote:
Actually just got a copy of Spinrite burned and am going to try it now. Good timing :lol:


:) I would LOVE to know if you think it's worth buying...I've been thinking about getting it "just in case"...since several of my drives are getting kind of old. Please let us know your opinion of it!

Posted: Tue Oct 16, 2007 3:06 pm
by Usacomp2k3
Well my opinion is that it's not worth it. I couldn't find any functionality to offload the data onto another drive. It just fixes files/partitons It seems to be recovery for soft-errors only, as opposed to failing drives. So doesn't help in my case.

Currently using gddrescue on the Ubuntu liveCD.

Posted: Tue Oct 16, 2007 3:10 pm
by gerbilspy
Usacomp2k3 wrote:
Well my opinion is that it's not worth it. I couldn't find any functionality to offload the data onto another drive. It just fixes files/partitons It seems to be recovery for soft-errors only, as opposed to failing drives. So doesn't help in my case.

Currently using gddrescue on the Ubuntu liveCD.


Thanks for the input. I'll save my $

Posted: Tue Oct 16, 2007 3:14 pm
by Usacomp2k3
So ddrescue seems to be working. For future reference, just throw in a live cd and do:
"sudo apt-get install gddrescue"
Then in order to do the backup, given /dev/sdb1 being a bad drive and /dev/sda1 being a good drive, you do this:
"sudo ddrescue /dev/sdb1 /dev/sda1"

At least that's what I did. I'll check back tomorrow and see if it worked.

Posted: Tue Oct 16, 2007 9:37 pm
by Usacomp2k3
And now begins the slow process of trying to get my server back into the state that it was in *sigh*

Posted: Wed Oct 17, 2007 12:24 am
by Usacomp2k3
Well have almost everything back to normal! Woohoo. Still need to figure out some permission stuff due to me taking people's advice and not just always logging in as root.

Posted: Wed Oct 17, 2007 7:43 am
by gerbilspy
Usacomp2k3 wrote:
So ddrescue seems to be working. For future reference, just throw in a live cd and do:
"sudo apt-get install gddrescue"
Then in order to do the backup, given /dev/sdb1 being a bad drive and /dev/sda1 being a good drive, you do this:
"sudo ddrescue /dev/sdb1 /dev/sda1"

At least that's what I did. I'll check back tomorrow and see if it worked.


I guess this is a dumb question, but could I use this technique on a Windows machine? A friend just called me and I now have a data recovery mission! :(

Posted: Wed Oct 17, 2007 8:42 am
by zgirl
gerbilspy wrote:
Usacomp2k3 wrote:
So ddrescue seems to be working. For future reference, just throw in a live cd and do:
"sudo apt-get install gddrescue"
Then in order to do the backup, given /dev/sdb1 being a bad drive and /dev/sda1 being a good drive, you do this:
"sudo ddrescue /dev/sdb1 /dev/sda1"

At least that's what I did. I'll check back tomorrow and see if it worked.


I guess this is a dumb question, but could I use this technique on a Windows machine? A friend just called me and I now have a data recovery mission! :(


You could look for a copy of XPE, which is an embedded verision of XP. Boots from the CD and loads the OS from there. Can't promise it can read y our disk, but I have used it in the past to get data off fubar'd OS drives. Then reformat.

Posted: Wed Oct 17, 2007 9:34 am
by Usacomp2k3
So any hints on where mysql stores it's data? I'm going back in to work to see what was recovered later today, but I'd like to be able to see right away whether the most important thing was recovered, that is, the database.

Posted: Wed Oct 17, 2007 9:54 am
by king_kilr
On ubuntu it looks like it is at /var/lib/mysql/

Posted: Wed Oct 17, 2007 2:30 pm
by Usacomp2k3
Well the recovery crapped out due to running out of space (40gb -> 40gb...not quite sure how it ran out), but it looks like most of my files are there.

Unfortunately the whole /etc directory is missing, and there's no mysql directory in /var/lib, only a mysql-cluster which is empty. Hmm

Now to figure out how to open the dd'd .img file in windows so that I can copy the data off (since linux won't write to ntfs).

Posted: Wed Oct 17, 2007 2:33 pm
by bitvector
Usacomp2k3 wrote:
(since linux won't write to ntfs).

Sure it will. It has for a long time now. apt-get install ntfs-3g (or ntfs-config, for a graphical configuration). You might need to enable universe repositories if they aren't already enabled.

Posted: Wed Oct 17, 2007 3:13 pm
by ssidbroadcast
I saw a thread a while back about recovering data from a hard drive by freezing it. Apparently there's a right way and a… wrong way to do it. A very wrong way to do it.

I tried the forum search but when I pressed "Search" nothing happened. Anyone got that thread link?

Posted: Wed Oct 17, 2007 5:22 pm
by Ragnar Dan
bitvector wrote:
Usacomp2k3 wrote:
(since linux won't write to ntfs).

Sure it will. It has for a long time now. apt-get install ntfs-3g (or ntfs-config, for a graphical configuration). You might need to enable universe repositories if they aren't already enabled.

How about mounting NTFS drives in a Linux VM? I checked fdisk and couldn't find any other devices but the one set up when I first installed VMWare. I also couldn't find ntfs-config when trying to apt-get it. But that means nothing until I can figure out how to make my VM read my drives... anyone know if it's possible?

Posted: Wed Oct 17, 2007 5:54 pm
by bitvector
Ragnar Dan wrote:
How about mounting NTFS drives in a Linux VM? I checked fdisk and couldn't find any other devices but the one set up when I first installed VMWare. I also couldn't find ntfs-config when trying to apt-get it. But that means nothing until I can figure out how to make my VM read my drives... anyone know if it's possible?

Host drives or partitions? Note that you can't (shouldn't) mount a filesystem within a VM that is simultaneously mounted by another OS (it's a surefire way to get metadata and data corruption). Now with that caveat in mind, just using a host partition or drive directly within a guest depends on the VM, but you can generally expose host physical drives and partitions directly to the virtual machine through the VM config. VMware lets you do that. The fact that the partition is NTFS doesn't have any bearing on the situation. Any FS that the guest can mount will work as long as you properly "expose" it to the VM.

Posted: Wed Oct 17, 2007 7:40 pm
by Ragnar Dan
It must be possible only on the versions they sell, not the free one(s). I tried looking for ways to add other drives months back when I first installed VMWare, and that's how it seems to be. The "Add" button is grayed out in what looks like the place where I'd add them (VM->Settings, Hardware tab, and on the list, Hard Disk).

I was thinking there was a way to mount something read-only, but I didn't see that option and since reading NTFS from Linux is new to me, I'm definitely not interested in doing anything dangerous.

Thanks for the reply.

Posted: Wed Oct 17, 2007 9:40 pm
by bitvector
You can do it by manually editing the vmx file, but I don't know the syntax for specifying Windows physical disks. I do know you set the ideX:X.deviceType = "rawDisk" (or scsiX:X.deviceType).

I'm not sure if you're just trying to share files, but if so, you could enable file sharing on the Windows host and use Samba in Linux to access it. Alternately, you could run an ssh server in the Linux guest and use psftp (Putty's sftp) from Windows to get and put files.

Posted: Thu Oct 18, 2007 11:00 am
by Usacomp2k3
Well darn. Due to the lack of the /etc folder I decided to try to re-recover.
I unmounted the 250gb drive in the server, and then set it to resize down to leave 50gb free, which I then had it make a new ext2 partition out of that. I hit the apply button, and it seems to be working, but was taking awhile, so I just left it overnight. Got up this morning and it still says that it's resizing the 250gb partition. Uh-oh. That can't be good, can it? I hit the cancel button and it popped up a note saying that cancelling would bring about the end of the world, so I told it to go back and resume.

So now I'm scared to cancel it and don't want to lose the data on that drive. Any suggestions?

EDIT: ssh'ing into it from work delivers this:
Image
So it's still running, but it shouldn't take 12 hours, should it?

Posted: Thu Oct 18, 2007 12:25 pm
by Usacomp2k3
Well I went ahead and restarted the computer remotely and everything seems to be working *crosses fingers*
I'll try the restore again when I get home. I got a nifty liveCD called Parted Magic that actually includes dd_rescue, so hopefully that'll help too 8)

Posted: Thu Oct 18, 2007 11:40 pm
by Usacomp2k3
**** -pcfx /dev/hdc1
is my friend.

For some reason gparted shows it as a single full 232gb partition now, even though it should have 55gb of free space. That's fishy. Hence why I'm running ****.

Posted: Thu Oct 18, 2007 11:46 pm
by bitvector
Usacomp2k3 wrote:
Hence why I'm running ****.

Why does the board think **** is profanity? :lol:

Posted: Fri Oct 19, 2007 1:23 am
by Usacomp2k3
Well darn. It's still saying that the drive only has 5.25 GiB of unused space. That's no good. The **** output did say that there was "1 large file" which I'm guessing is the culprit. Now to just find him and nail him to the wall. Hmm.

EDIT: hmm. Well I did a check via gparted (this is all still in that nifty liveCD I linked a few posts ago), and it gave the same output as running it manually, but now it shows the proper amount of free space. So now I'm resizing and creating the new partition. W00t! This could take awhile though. Good thing I have a research paper to write for tomorrow 8)

Posted: Sat Oct 20, 2007 4:16 pm
by Ragnar Dan
bitvector wrote:
You can do it by manually editing the vmx file, but I don't know the syntax for specifying Windows physical disks. I do know you set the ideX:X.deviceType = "rawDisk" (or scsiX:X.deviceType).

I'm not sure if you're just trying to share files, but if so, you could enable file sharing on the Windows host and use Samba in Linux to access it. Alternately, you could run an ssh server in the Linux guest and use psftp (Putty's sftp) from Windows to get and put files.

What I'd really like is if I could Copy and Paste from Windows to Linux and back. VMware makes it seem as though it might be possible, what with it having an Edit menu item with the standard features, but it doesn't work in either direction, which is rather frustrating.

I've got Samba running to read my FAHlog.txt file from the Linux SMP client, but I'll have to dig into it more to figure out how to change it to let me save files anywhere. My big problem is I keep forgetting what I just learned how to do a couple of weeks ago.

Posted: Sat Oct 20, 2007 4:33 pm
by bitvector
Ragnar Dan wrote:
What I'd really like is if I could Copy and Paste from Windows to Linux and back. VMware makes it seem as though it might be possible, what with it having an Edit menu item with the standard features, but it doesn't work in either direction, which is rather frustrating.

That's exactly what VMware tools enables. You install VMware tools in the guest to get two way copy & paste. Previously, that was a perk of the pay VMware over the free version. Just last month, though, VMware unveiled an open-source version of the tools: Open VM Tools. It is too new to have official packages for Ubuntu, though. Debian has a contrib package in experimental, which means it's too new and untested to even go into unstable, but you might try grabbing the deb source and building it if you use a Debian derivative (or just grab the official source and build). What distro & version are you running in the VM? I just built a test package of open-vm-tools for a gutsy VM and it works pretty well (it at least supports cut & paste in X as well as seamless mouse movement between VM and host); I could build one for your distro/version/architecture if it's Debian or Ubuntu.

Posted: Sun Oct 21, 2007 11:18 pm
by Usacomp2k3
So I have the hard drive I backed the dead one up to plugged in via an external USB device. Now how do I get linux to see it? There's no "device manager" that I can find. *scratches head*