From hubert.tournier@online.fr  Sun Mar 18 02:28:06 2001
Return-Path: <hubert.tournier@online.fr>
Received: from postfix2-1.free.fr (postfix2-1.free.fr [213.228.0.9])
	by hub.freebsd.org (Postfix) with ESMTP id 50FB137B718
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Mar 2001 02:28:06 -0800 (PST)
	(envelope-from hubert.tournier@online.fr)
Received: from online.fr (nas-cbv-4-45-47.dial.proxad.net [213.228.45.47])
	by postfix2-1.free.fr (Postfix) with ESMTP id 5B293C0E0
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Mar 2001 11:28:03 +0100 (CET)
Message-Id: <3AB48DA2.7F62060B@online.fr>
Date: Sun, 18 Mar 2001 11:27:46 +0100
From: Hubert Tournier <hubert.tournier@online.fr>
Reply-To: hubert@tournier.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: FDISK lost a partition !

>Number:         25889
>Category:       i386
>Synopsis:       FDISK lost a partition !
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 18 02:30:03 PST 2001
>Closed-Date:    Sat Aug 10 07:50:37 PDT 2002
>Last-Modified:  Sat Aug 10 07:50:37 PDT 2002
>Originator:     Hubert Tournier
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
Maison
>Environment:

I use an ASUS motherboard with ASUS P5 A-B ACPI BIOS Revision 1010 (with
support for disks over 8.4 GB).

Here is the description of the hard disk drive I'm using (from
/var/log/messages) :
ad0: 19574MB <WDC WD205BA> [39770/16/63] at ata0-master UDMA33

>Description:

SUMMARY: I lost a partition beginning after the 8.4MB limit after an
ugrade from FreeBSD 4.0-RELEASE to 4.2-RELEASE made with a complete
reinstall of the operating system.

Here was my partition information BEFORE the problem :

MBR/PT track
100 MB DOS partition
4000 MB Win partition
3992 MB FreeBSD 4.0 partition
11476 MB Win data partition (extended I think).

When I first entered FDISK, here's what I saw (from memory) :

Disk Geometry 2495 cyls/255 heads/63 sectors = 40082175 sectors (19571
MB)
Offset		Size (ST)	End		Name	PType	Desc	Subtype	Flags
0		63		62		-	6	unused	0
63		208782		208844		ad0s1	2	fat	6
208845		8193150		8401994		ad0s2	2	fat	11
8401995		8177085		16579079	ad0s3	3	freebsd	165
16579080	23509080	40088159	-	6	unused	0

The last entry was incorrect : it should have been my 11 Go windows data
partition.

Although I was surprised, I thought the FDISK utility may have been
troubled with that partition starting after the 8.4 GB limit.

I decided to install anyway using the same parameters than the existing
FreeBSD 4.0-RELEASE partition.

The install went fine as usual, but both FreeBSD and Windows could not
see the windows data partition afterwards.

Using a disk editor, I saw that the fourth partition entry in the
partition table had been zeroed.

I think this is the only impact, but at this time, I haven't been able
to restore values enabling Windows or FreeBSD to see the lost partition.

>How-To-Repeat:

It's not possible for me to repeat the problem at this time, because I
want to try different things in order to recover the partition data.

Perhaps, on another machine, someone could try the following procedure :
- Use a disk larger than 8.4 GB,
- Create a partition layout similar to the one I was using,
- Create an extended partition beginning after the 8.4 GB limit,
- Overwrite an existing FreeBSD installation using the FreeBSD
4.2-RELEASE installer,
- See if the extended partition is still there.

>Fix:

PROPOSED MODIFICATION: In my opinion, the safest method would be to only
write back the modified partition entries in the table.

For my part, I used the FDISK utility to recreate something like that :

Disk Geometry 2495 cyls/255 heads/63 sectors = 40082175 sectors (19571
MB)
Offset		Size (ST)	End		Name	PType	Desc		Subtype	Flags
0		63		62		-	6	unused		0
63		208782		208844		ad0s1	2	fat		6
208845		8193150		8401994		ad0s2	2	fat		11
8401995		8177085		16579079	ad0s3	3	freebsd		165
16579080	23503095	40082174	ad0s4	1	extended DOS	5
40082175	5985		40088159	-	6	unused		0

But at this time, it doesn't solve my problem (the last partition is
still unrecognised).

I plan to fiddle with the partition type, then, in last recourse, to
write a specific recovery program under FreeBSD (I already did this for
an HPFS partition in the past).

Here is my partition information AT THIS TIME :

******* Working on device /dev/ad0 *******
parameters extracted from in-core disklabel are:
cylinders=2495 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=2495 heads=255 sectors/track=63 (16065 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 6,(Primary 'big' DOS (> 32MB))
    start 63, size 208782 (101 Meg), flag 0
	beg: cyl 0/ sector 1/ head 1;
	end: cyl 12/ sector 63/ head 254
The data for partition 2 is:
sysid 11,(DOS or Windows 95 with 32 bit FAT)
    start 208845, size 8193150 (4000 Meg), flag 0
	beg: cyl 13/ sector 1/ head 0;
	end: cyl 522/ sector 63/ head 254
The data for partition 3 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 8401995, size 8177085 (3992 Meg), flag 80 (active)
	beg: cyl 523/ sector 1/ head 0;
	end: cyl 1023/ sector 63/ head 254
The data for partition 4 is:
sysid 5,(Extended DOS)
    start 16579080, size 23503095 (11476 Meg), flag 0
	beg: cyl 1023/ sector 63/ head 255;
	end: cyl 1023/ sector 63/ head 254

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: sheldonh 
State-Changed-When: Wed Jan 30 05:57:41 PST 2002 
State-Changed-Why:  
Anyone able to reproduce this on recent FreeBSD installations? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25889 

From: Thao et Hubert Tournier <hubert.tournier@online.fr>
To: sheldonh@FreeBSD.org
Cc: freebsd-bugs@FreeBSD.org
Subject: Re: i386/25889: FDISK lost a partition !
Date: Fri, 01 Feb 2002 00:29:04 +0100

 Hello,
 
 sheldonh@FreeBSD.org wrote:
 > 
 > Synopsis: FDISK lost a partition !
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: sheldonh
 > State-Changed-When: Wed Jan 30 05:57:41 PST 2002
 > State-Changed-Why:
 > Anyone able to reproduce this on recent FreeBSD installations?
 > 
 > http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25889
 
 It's nice to hear from you.
 
 I never encountered this problem again (I will have a new chance this
 week-end during a 4.4R to 4.5R upgrade. This time I will make a backup
 before :-)).
 
 Anyway, I recovered nearly all of my data on the lost partition,
 although something else had been screwed (maybe in the partition boot
 sector) apart from the partition entry.
 
 I still think that having Fdisk modify only partition entries which have
 changed would be the way to go.
 
 Just my 2c.
 
 Have a nice day !
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
State-Changed-From-To: feedback->closed 
State-Changed-By: schweikh 
State-Changed-When: Sat Aug 10 07:49:11 PDT 2002 
State-Changed-Why:  
Originator says he never encountered this problem again. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25889 
>Unformatted:
