Skip site navigation (1)Skip section navigation (2)
Date:      23 Mar 1998 17:32:47 -0500
From:      Andrew Hobson <ahobson@eng.mindspring.net>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Finding an FS on the disk
Message-ID:  <kjemztqbqo.fsf@computer.eng.mindspring.net>
In-Reply-To: Andrew Heybey's message of "23 Mar 1998 16:33:40 -0500"
References:  <Pine.BSF.3.96.980323224325.13652D-100000@haldjas.folklore.ee> <85afahf5xn.fsf@stiegl.niksun.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 23 Mar 1998 16:33:40 -0500, Andrew Heybey <ath@niksun.com> said:

> Here is some code I wrote when I had a similar problem under SunOS.  I
> just modified it to compile and (apparently) work under FreeBSD.

I did just about the same thing, except I used a shell script:

#!/usr/local/bin/zsh
for x in {0..1024}; do
  dd if=/dev/sd0 bs=1m skip=$x count=1 of=/tmp/ddfile 2>/dev/null
  echo "$x:"
  hexdump /tmp/ddfile | grep '1954 0001$'
done
exit 0


All of the information below is gleaned from experience and not from
reading the code, so I hope it's accurate for more than just my
computer.

When you see two magic numbers separated by 8k:

128: 000a350 0001 0000 0000 0000 0000 0000 1954 0001
000c350 0001 0000 0000 0000 0000 0000 1954 0001

You should have found a partition.

Of course, then you have to figure out how to construct your disklabel
appropriately.  In my case, it found the block at 128M (if your
partitions are aligned on MB boundaries, then you should see the magic
numbers at offsets a350 and c350 like I do above), so this partition
would be at offset 128*1024*2 = 262114.

Drew

-- 
"Joe, release me from your Kung-Fu grip." -- Stacy Lavelle

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?kjemztqbqo.fsf>