Some time ago I had a hard drive crash on me and I made a copy of the hard drive using dd_rescue.
I eventually got a another hard drive and am trying to restore the backup.img from and external usb drive to my new drive, but to no avail. Here is what I have tried:
mount -o loop /local/backup.img /local1/recoverydata
returns
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
and
e2fsck -y /dev/sda1/backup.img
returns
e2fsck 1.40.8 (13-Mar-2008)
e2fsck: Not a directory while trying to open /dev/sda1/backup.img
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
mkdir /mnt/recoverydata
then if this it the correct path /dev/sda1/backup.img
mount /dev/sda1/backup.img /mnt/recoverydata
then
cd /mnt/recoverydata
can you see it?
don’t forget to “umount” it.
You could try adding that disk to “fstab”, give it a mount point say /data1 (use Yast partitioner) and reboot. If it can be read, should be there
or
try the old disk one more time if your backup can’t be read.
Hi snakedriver, thanks for the reply. unfortunately this is what I get:
linux-v0ej:/local1 # mkdir /local1/recoverydata
linux-v0ej:/local1 # mount /dev/sda1/backup.img /local1/recoverydata
mount: special device /dev/sda1/backup.img does not exist
(a path prefix is not a directory)
linux-v0ej:/local1 # mount /local/backup.img /local1/recoverydata
mount: /local/backup.img is not a block device (maybe try `-o loop'?)
linux-v0ej:/local1 # mount -o loop /local/backup.img /local1/recoverydata
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
The drive was a second hard drive just for storing data and I think that it was physically scratched, could it be that some areas of the backup.img are corrupted due to this.
In this case is it possible to just restore everything as it is, damaged or not?
Thanks for the reply, but I am not sure if I understand your code properly. To summarise I have the following setup:
Harddrive 1 = system and /home = 40GB
Harddrive 2 = /dev/sda1 = /local = 320GB (contains backup.img)
Harddrive 3 = /dev/sdb1 = /local1 = 1TB (where I want to restore the backup.img)
In your code I have changed the “/mnt/recoverydata” to “/local1/recoverydata”
The problem after running the code you gave is that I get a warning that my /home directory is full, so it seems to be trying to restore the image to my /home directory and not the /local1 where I want it. How do I restore it to /local1?
I think you have /dev/sda1 mounted in directory /local and I think that /local contains a file backup.img. Is that right?
Question about the image: Did you make an image of the whole drive or just of a partition?
If it was just a partition you would have issued a command like this:
Something along those lines – so did you save the image of a whole drive or just a partition. I ask because how you prepare the terabyte drive, depends on what’s coming in the image.
And finally, please paste back here the response that you get to this command in a console:
and it did something for a while, then gave the output:
390721968+0 records in
390721968+0 records out
200049647616 bytes (200 GB) copied, 3852.8 s, 51.9 MB/s
Which seems to indicate that it just made a copy of the file, which indeed it seems to have done, because I now have a file called “recover” on the TB drive, but it is of unknown type and I cannot browse in it.
To answer your question about the backup, I cannot remember if I backed up /dev/sdb/ or /dev/sdb1, either way the drive was just 1 partition.
Here is the result of the command you asked me to run:
linux-v0ej:/home/andre # /sbin/fdisk /dev/sdb -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00072b14
Device Boot Start End Blocks Id System
/dev/sdb1 1 121601 976760001 83 Linux
So I still have the problem that I cannot access the so called restored data. Do you have any ideas, please?
Well we’ll assume first that it was just a partition, not a drive, and that the partition you backed up was a Linux ext3 partition. If either of these two things are not correct the following will not work. It will appear to work but the result will be quite wonky. So tell me if I am wrong about ext3. The following will occupy 1000Gb. If the original drive was much less than that you should first shrink partiton sda1 to save wasting space. You can do that in Yast’s partitioner. Make it the same size as the original +5%. If you’ve forgotten the size, it’s the same size as the image file.
When you’re ready:
You can’t restore to a mounted partition, so open a console, enter su to get rootly powers. Then enter this command to unmount the partition:
umount /dev/sdb1
Then this command will write the image across to the waiting ext3 partition:
Questions:
Q1: I need more information about the system error code: What exactly were you doing and what did it say (more then “system error code - 3003”).
Q2: How big was the original drive and how many partitions were on it?
Q3: You have a directory /local1. Make sure nothing is mounted in it and that it contains no files. Then execute this command in a console:
sudo mount /dev/sdb1 /local1
And copy the dialogue (from the console) into your forum reply.
A1: I was trying to mount the drive using Yast/Partitioner. I just chose /dev/sdb1 and tried to give it a mount point.
A2: It was 200GB and only had 1 mount point I think.
A3:
linux-v0ej:/home/andre # sudo mount /dev/sdb1 /local3
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Thanks for the help so far.
P.S. I used local3 because local2 has been deleted
That message “missing superblock etc …” is perhaps like saying “huh! what filesystem is this …”. Not surprising since it’s at least badly damaged. Another possibility is that it was NTFS or Reiserfs, not ext3. What was the filesystem? If you don’t know then: what was the operating system, windows or Suse, and what was the version (XP, vista, win98, Suse 10.0, 10.1, 10,2, …) and what was it used for (the whole operating system plus storage, or just storage … I need a few clues, something)?
OK, assuming it’s ext3 for the moment, try running this command (su to be root first):
e2fsck -p /dev/sdb1
That checks the filesystem (maybe).
[Aide memoire: this might be the wrong approach if the image was an image of the whole drive, not just a partition]
So please supply the clues and (if it’s not a drive from windows or Reiserfs from Suse 10.0 or 10.1) run the command.
The drive was 2nd hard drive (i.e. no OS installed) for media files mostle. It was first used with OpenSuse 9,3 and later I upgraded to 10,2.
It was originally formatted as a Reiser drive and the whole drive was a single partition. Unfortunately I am at work at the moment so will only be able to run the command you request this evening.
Other information is that the 1TB drive I am using to restore the image onto is formatted as ext3, should I start again with this drive restore as Reiserfs?
You should prepare the 1Tb drive by deleting the ext3 (it will be all messed up after the last procedure anyway) and making a Reiser partition 10% larger than the original. You can see the original from the size of the image file.
So if that’s sdb1, don’t mount it. Write the partition from the image across to sdb1 using previous method:
dd_rescue /localxyz/backup.img /dev/sdb1
(local3? for localxyz)
Then run this command to see how successful it was:
reiserfsck --check /dev/sdb1
It probably will say some pretty awful things (because of the missing and corrupted data from the old bad blocks). So paste that dialogue back here.
But when I run the reiserfsck --check /dev/sdb1 command I get:
linux-v0ej:/home/andre # reiserfsck --check /dev/sdb1
reiserfsck 3.6.19 (2003 www.namesys.com)
*************************************************************
** If you are using the latest reiserfsprogs and it fails **
** please email bug reports to reiserfs-list@namesys.com, **
** providing as much information as possible -- your **
** hardware, kernel, patches, settings, all reiserfsck **
** messages (including version), the reiserfsck logfile, **
** check the syslog file for any related information. **
** If you would like advice on using this program, support **
** is available for $25 at www.namesys.com/support.html. **
*************************************************************
Will read-only check consistency of the filesystem on /dev/sdb1
Will put log info to 'stdout'
Do you want to run this program?[N/Yes] (note need to type Yes if you do):Yes
###########
reiserfsck --check started at Sat Sep 6 14:50:37 2008
###########
Replaying journal: No transactions found
Zero bit found in on-disk bitmap after the last valid bit.
Checking internal tree..
Bad root block 0. (--rebuild-tree did not complete)
Aborted