Restoring data from a hard drive
I just made a stupid mistake: I mounted an HDD to a PC (Vista). First the disk was not connected - showing as 'foreign' or something in Disk Management. I know I was supposed to do 'Import foreign disk' but in a rush I clicked on 'convert to basic disk'. Now I have lost the volume/partition information and the disk is showing 'Unallocated'. Everything happened in just a fraction of second and now I am really panic. By any chance can I restore the data from the disk? I would be very grateful for any advice you may have!
Re: Restoring data from a hard drive
If you can remember the EXACT configuration of your parition table you MIGHT be able to restore it and the system MIGHT recognise the partition. But you are far more likely to get the data using a data recovery tool.
I would try restoring the parition table, however, I would do it on an image of the disk, so that the orignal is intact. I assume you know how to dd and have enough free space/a spare disk somewhere?
Re: Restoring data from a hard drive
Many thanks, nightkhaos!
I have not used the disk for a long time but I am (fairly) sure there is only one partition on it and it is a data disk so there is no booting/OS info on it. Yes, I have an additional drive to back up the whole image. Could you please tell me some details on how to proceed (what is dd BTW)? Many thanks in anticipation!
Re: Restoring data from a hard drive
Quote:
Originally Posted by
fedora
Many thanks, nightkhaos!
I have not used the disk for a long time but I am (fairly) sure there is only one partition on it and it is a data disk so there is no booting/OS info on it. Yes, I have an additional drive to back up the whole image. Could you please tell me some details on how to proceed (what is dd BTW)? Many thanks in anticipation!
dd is a bit for bit data cloning tool. You will need a Linux system, or LiveCD. Your source disk, I'll call /dev/sdx. Now, you will need a parition in a format the supports large file sizes, because a parition table restore will not work if the disks are different sizes if you not entirely sure exactly how many clinders the orignal source disk used, thus we are going to create an image file. So if your source disk is 100GB you need any empty parition of about 120GB. Okay? I have assumed you mounted the disk at /media/disk/
Simply put it'll be the following command to image it. dd has some flags that can be used for optimisations, but without knowing your hardware configuration exactly I am not sure as to what to use:
Code:
dd if=/dev/sdx of=/media/disk/image
This will take some time. Likely overnight. But the advantage of doing this is any of the restore techniques you try will not destory the orignal data.
Then all you should need to do is try and put a partition table on the image. I recommend cfdisk as it has an easy to use UI:
Code:
cfdisk /media/disk/image
Then when you've done that you'll want to try mounting the image. To do this you'll need to know where the partition is. You can do this using a tool called sfdisk.
Code:
sfdisk -l -uS /media/disk/image
This offset is given is sectors, so you need to multiply the offset by 512 for the next part, where we attempt to mount the parition. Say the parition starts 2 sectors in, that's 1024 bytes.
Code:
mount -oloop;offset=1024 /media/disk/image /media/image
If it restores, and you can access the data and everything, then all you will need to do is restore the fixed image to the hard drive, using dd once again.
Code:
umount /media/image
dd if=/media/disk/image of=/dev/sdx
However, if it's an old disk, and there isn't to much data to recover (or the data isn't particularly important), you will likely save a lot of time using a data recovery tool of some kind. Mainly because the method I mentioned above might not work for various reasons.
A data recovery tool might also be easier considering your needs.
Re: Restoring data from a hard drive
Re: Restoring data from a hard drive
Hmm... I also found this helpful guide, but I still recommend creating a dd image just in case. :)
Recovering Lost Partitions
Re: Restoring data from a hard drive
Many thanks, guys. I think I know how to do, but I will leave it for a couple of days just in case I will make another silly mistake. :(
A final question, nightkhaos - is it really necessary to create an image? It seems to me all partition recovery tools will only touch the MBR, and the MBR in my disk has already been damaged anyway.
Re: Restoring data from a hard drive
Quote:
Originally Posted by
fedora
Many thanks, guys. I think I know how to do, but I will leave it for a couple of days just in case I will make another silly mistake. :(
A final question, nightkhaos - is it really necessary to create an image? It seems to me all partition recovery tools will only touch the MBR, and the MBR in my disk has already been damaged anyway.
It is necessary just in case something goes wrong! better to be save than sorry.