From owner-freebsd-questions Fri Mar 26 18: 4:31 1999 Delivered-To: freebsd-questions@freebsd.org Received: from pcayk.ukc.ac.uk (pcayk.ukc.ac.uk [129.12.41.131]) by hub.freebsd.org (Postfix) with ESMTP id 4EF8D14DE2 for ; Fri, 26 Mar 1999 18:04:28 -0800 (PST) (envelope-from dlombardo@excite.com) Received: from excite.com (localhost [127.0.0.1]) by pcayk.ukc.ac.uk (8.9.2/8.9.2) with ESMTP id CAA89228 for ; Sat, 27 Mar 1999 02:04:10 GMT (envelope-from dlombardo@excite.com) Message-ID: <36FC3C95.97F5B977@excite.com> Date: Sat, 27 Mar 1999 02:04:06 +0000 From: Dean Lombardo Organization: University of Kent at Canterbury, UK X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: questions@freebsd.org Subject: Rescuing FreeBSD partition table Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dear all, I made an unfortunate mistake of giving my hard drive to a friend who wanted to mount it under Linux. Apparently he didn't use Linux's BSD disklabel support, and somehow managed to screw up the partition table. I used to have all the usual four partitions (/, swap, /var and /usr), /usr being the largest of the four, and now disklabel /dev/wd2s1 now only shows partition c: > # /dev/wd2s1: > type: ST506 > bytes/sector: 512 > sectors/track: 63 > tracks/cylinder: 16 > sectors/cylinder: 1008 > cylinders: 16382 > sectors/unit: 16514001 > rpm: 3600 > > 4 partitions: > # size offset fstype [fsize bsize bps/cpg] > c: 16514001 0 unused 0 0 # (Cyl. 0 - 16382*) Here 16382 is the *total* number of cylinders (all 8 Gb), but of course it should be something like: a 0-130 b 130-650 c 0-16382 d 650-780 e 780-16382 It used to be a FreeBSD 2.2.8 drive, and I also think that cylinders 0-63 were unused (correct me if I'm wrong). Why is it saying "4 partitions" but only showing one? I can even mount this partition, and FreeBSD thinks it's the root partition (/), which of course I'm not very interested in (/usr is the one I need). I'm pretty sure the data are physically still there, it's just the bit in the beginning of the disk that's gone. The problem is that of course I don't remember the actual cylinder boundaries of partitions. My question is - how do I find the cylinder boundaries of partitions - what program can I use to inspect the disk? I also have another drive of exactly the same size and make that I can experiment with - wouldn't it be a good idea to make an exact copy of the original drive and then experiment with the copy - how do I do that? Will a simple "dd if=/dev/wd1 of=/dev/wd2" do the job? Finally, once I've found out the cylinder boundaries, what program can I use to write the partition table to the disk (and the partition table only, without touching the data)? Please help! Dean P.S. fdisk /dev/wd2 shows: > ******* Working on device /dev/wd2 ******* > parameters extracted from in-core disklabel are: > cylinders=16383 heads=16 sectors/track=63 (1008 blks/cyl) > > Figures below won't work with BIOS for partitions not in cyl 1 > parameters to be used for BIOS calculations are: > cylinders=16383 heads=16 sectors/track=63 (1008 blks/cyl) > > Media sector size is 512 > Warning: BIOS sector numbering starts with sector 1 > Information from DOS bootblock is: > The data for partition 1 is: > sysid 165,(FreeBSD/NetBSD/386BSD) > start 63, size 16514001 (8063 Meg), flag 80 (active) > beg: cyl 0/ sector 1/ head 1; > end: cyl 1023/ sector 63/ head 15 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message