Re: Recovering partitions from disk image? *resolved*

2009-04-05 Thread Wojciech Puchar
so write a short article about how you did this and why using hardware 
RAID solutions is bad, and put it on your website.


it's AT LEAST funny that your hardware raid instead of protecting - 
rendered your data inaccessible.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Recovering partitions from disk image? *resolved*

2009-04-04 Thread snott

If anyone's interested, the last post I made about doing a bsdlabel, fsck,
mdconfig etc on the damaged disk image worked.  I have recovered all my
files!  Hooray!!!

Skye

-- 
View this message in context: 
http://www.nabble.com/Recovering-partitions-from-disk-image--tp22862006p22889910.html
Sent from the freebsd-questions mailing list archive at Nabble.com.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Recovering partitions from disk image?

2009-04-03 Thread Wojciech Puchar

Hello FreeBSD gurus,

I recently had the pleasure of trying to recover a failed RAID1 array.  It
consisted of two 120GB disks in mirrored configuration.  Both drives have a
ton of bad sectors, so bad that the 3ware RAID card stopped recognizing that
there was a mirror at all.  Having no other options that I could think of, I


excellent hardware - designed to PROTECT ;)


pulled the drive with the one with the least read errors, directly connected
it to ATA bus and used GNU ddrescue to make a disk image with only about 7
read errors.

Neither fdisk nor bsdlabel can read the disk image.  I wonder if there's
some funny data at the beginning of the hard drive the 3ware card used for
RAID configuration?  If this is true, is there a way to search for the
beginning of the real fdisk data and lop it off to make a possibly valid
disk image?


do

dd if=image bs=128k count=1|hexdump -C|less

and look for it :)

at MBR sector you'll see probably something at the end like this:


0190  46 0a d0 e3 00 5e 05 28  46 02 77 88 c3 52 65 61 
|F.##.^.(F.w.#Rea|
01a0  64 00 42 6f 6f 74 00 20  65 72 72 6f 72 0d 0a 00  |d.Boot. 
error...|


for bsdlabel it's easier it's WEV and first 3 bytes.




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Recovering partitions from disk image?

2009-04-03 Thread snott

Update: I figured out how to get scan_ffs to read a file by looking at the
program source (if it starts with / then it considers it a regular file to
read instead of a device) and got the following results which matches well
with the TestDisk output.

$ scan_ffs -s /recovery/disk0.img 
ufs1 at 1087 size 2621440 mount / time Wed Dec 31 16:00:00 1969
ufs1 at 10486847 size 5242880 mount /var time Wed Dec 31 16:00:00 1969
ufs1 at 31458367 size 5242880 mount /usr/home time Wed Dec 31 16:00:00 1969
ufs1 at 54525634 size 46680873 mount /mnt time Wed Dec 31 16:00:00 1969

Looks about right compared to the df output I had from that host:

Filesystem  Size   Used  Avail Capacity  Mounted on
/dev/twed0s1a   4.9G   2.8G   1.7G62%/
/dev/twed0s1e   9.8G   5.0G   4.0G56%/var
/dev/twed0s1f   9.8G   952M   8.1G10%/usr/home
/dev/twed0s2e88G15G65G19%/mnt

So, what can I do with those numbers?  It doesn't look like there's any
valid MBR or disklabel on this disk image.  Can I extract these filesystems
one at a time from the image and mount them somehow?

Thanks,
Skye
-- 
View this message in context: 
http://www.nabble.com/Recovering-partitions-from-disk-image--tp22862006p22872988.html
Sent from the freebsd-questions mailing list archive at Nabble.com.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Recovering partitions from disk image?

2009-04-03 Thread Warren Block

On Fri, 3 Apr 2009, snott wrote:


Update: I figured out how to get scan_ffs to read a file by looking at the
program source (if it starts with / then it considers it a regular file to
read instead of a device) and got the following results which matches well
with the TestDisk output.

$ scan_ffs -s /recovery/disk0.img
ufs1 at 1087 size 2621440 mount / time Wed Dec 31 16:00:00 1969
ufs1 at 10486847 size 5242880 mount /var time Wed Dec 31 16:00:00 1969
ufs1 at 31458367 size 5242880 mount /usr/home time Wed Dec 31 16:00:00 1969
ufs1 at 54525634 size 46680873 mount /mnt time Wed Dec 31 16:00:00 1969

Looks about right compared to the df output I had from that host:

Filesystem  Size   Used  Avail Capacity  Mounted on
/dev/twed0s1a   4.9G   2.8G   1.7G62%/
/dev/twed0s1e   9.8G   5.0G   4.0G56%/var
/dev/twed0s1f   9.8G   952M   8.1G10%/usr/home
/dev/twed0s2e88G15G65G19%/mnt

So, what can I do with those numbers?  It doesn't look like there's any
valid MBR or disklabel on this disk image.  Can I extract these filesystems
one at a time from the image and mount them somehow?


Looks like scan_ffs is reporting block size.  I'd take a spare computer 
with a blank disk and do a minimal FreeBSD install on it, setting the 
units to blocks in the partition screen and duplicating the values given 
by scan_ffs.  Then connect your read-only image media and dd to each 
partition, using dd's skip option to skip over previous partition data.


Daring users (i.e., those who are sure they won't confuse source with 
target) might install a blank drive in a live machine and use fdisk, 
bsdlabel, and dd from there.


-Warren Block * Rapid City, South Dakota USA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Recovering partitions from disk image?

2009-04-03 Thread snott



Warren Block wrote:
 
 Looks like scan_ffs is reporting block size.  I'd take a spare computer 
 with a blank disk and do a minimal FreeBSD install on it, setting the 
 units to blocks in the partition screen and duplicating the values given 
 by scan_ffs.  Then connect your read-only image media and dd to each 
 partition, using dd's skip option to skip over previous partition data.
 

OK, I can see how that would work.  I don't really have a spare
computer/drive to muck around with though, at least not easily.  If I can
work directly on the disk image that would be much better.

Could I fix the bsdlabel on the disk.img and mount it with mdconfig?
I noticed scan_ffs can output a bsdlabel config file.  Something like:

# scan_ffs -sl disk.img  disk.label
# bsdlabel -w -f disk.img auto  # write a fresh default label
# bsdlabel -e -f disk.img  # and load in scan_ffs output
# mdconfig -a -t vnode -f disk.img -u 0

If that looks like it might work, should I fsck the disk image before or
after mounting with mdconfig or not at all?  Do I risk kernel panic without
fsck?

Thanks,
Skye

-- 
View this message in context: 
http://www.nabble.com/Recovering-partitions-from-disk-image--tp22862006p22878294.html
Sent from the freebsd-questions mailing list archive at Nabble.com.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org