This is very odd on several fronts. First, someone has obviously
been writing on the MBR for no good reason. I just tested an fdisk
compiled to day and noticed no oddities on my i386.

Second, the fact that you find a disklabel. Since we no longer store
or look for disklabels in FreeBSD partitions it is being
read from sector 1 if I recall the code correctly. But it should not
have been writing the disklabel there when there was an OpenBSD
partition to store it in.

Do you know if this is exactly the same disklabel you were using
before? Have you changed anything in the disklabel recently that
would identify this as an artifact that just happened to be lying in
sector 1 for a while?

Can you copy the MBR and send it to me. There might be a clue as to
what overwrote it. Then I would do "fdisk -i" and see what happens.
This will move the OpenBSD partition to partition 3, but cover the
entire disk as your original MBR did. Then see if the disklabel,
which should be read from the OpenBSD partition says.

.... Ken

On Fri, Jun 08, 2007 at 09:08:21PM -0500, Emilio Perea wrote:
> On Thu, Jun 07, 2007 at 04:58:18PM -0500, Emilio Perea wrote:
> > On Thu, Jun 07, 2007 at 07:50:24PM +0200, Otto Moerbeek wrote:
> > > I have thinking a bit more about the problem, and it is very likely the
> > > following scenario happened:
> > > 
> > > 1. Kernel upgrade by source.
> > > 
> > > 2. Reboot
> > > 
> > > 3. Kernel reads old disklabel format and converts it in-memory to the
> > > new v1 format. 
> > > 
> > > 4. Run a newfs using the old executable that does not know about the
> > > new disklabel format. newfs writes the block and fragment size info
> > > the old way, on a spot that is used in v1 labels to store the high 16
> > > bits of the offset and size of a partition. The label is written with
> > > version = 1, since the in-memory copy is v1. 
> > > 
> > > 5. Reboot, the kernel now sees a v1 disklabel with very high offset
> > > and/or size, the new consistency code (which is now disabled) kicks in
> > > and marks the partition as unused. 
> > > 
> > > So the lesson here is: keep userland and kernel in sync, or use a
> > > snapshot to upgrade. 
> > 
> > I believe that's exactly what happened the first time.  The catch is
> > that kernel and userland were being built from the same cvs update, and
> > I thought I was keeping them in sync.  In this case it would probably
> > have been better to skip the reboot between building the kernel and the
> > userland.
> 
> It might have been better to start a whole new thread, but it seemed
> logical to believe that the problems might be related.  Using recent
> snapshots, last night's insecurity output showed another disklabel
> change: 
> 
> ======
> sd1 diffs (-OLD  +NEW)
> ======
> --- /var/backups/disklabel.sd1.current        Fri Apr 20 01:31:19 2007
> +++ /var/backups/disklabel.sd1        Fri Jun  8 01:31:55 2007
> @@ -1,4 +1,4 @@
> -# Inside MBR partition 0: type A6 start 63 size 71681967
> +disklabel: warning, DOS partition table with no valid OpenBSD partition
>  # /dev/rsd1c:
>  type: SCSI
>  disk: da0s1
> *----------------------------------------------------------------------*
> 
> The full output of disklabel and dmesg follow, but as I was getting
> ready to send it, I remembered that this same disk had problems with the
> disklabel changes last October.  For some reason it was shown as having
> a FreeBSD disklabel.  Most of correspondence regarding it was off-list,
> but involved several developers and ended with Ken Westerback suggesting
> some tests before setting it to OpenBSD.
> 
> This was fdisk then:
> 
> Disk: sd1       geometry: 4462/255/63 [71682030 Sectors]
> Offset: 0       Signature: 0xAA55
>          Starting       Ending       LBA Info:
>  #: id    C   H  S -    C   H  S [       start:      size   ]
> ------------------------------------------------------------------------
> *0: A6    0   1  1 - 4461 254 63 [          63:    71681967 ] OpenBSD
>  1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
>  2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
>  3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
> 
> This is now:
> 
> Disk: sd1     geometry: 4462/255/63 [71687370 Sectors]
> Offset: 0     Signature: 0xAA55
>          Starting       Ending       LBA Info:
>  #: id    C   H  S -    C   H  S [       start:      size   ]
> ------------------------------------------------------------------------
>  0: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
>  1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
>  2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
> *3: A5    0   0  1 -    3  28 41 [           0:       50000 ] FreeBSD
> *----------------------------------------------------------------------*
> 
> It is currently working fine.  Should I just change the partition ID to
> A6, or is there something else I should try first?
> 
> *----------------------------------------------------------------------*
> disklabel: warning, DOS partition table with no valid OpenBSD partition
> # /dev/rsd1c:
> type: SCSI
> disk: da0s1
> label: 
> flags:
> bytes/sector: 512
> sectors/track: 63
> tracks/cylinder: 255
> sectors/cylinder: 16065
> cylinders: 4462
> total sectors: 71687370
> rpm: 3600
> interleave: 1
> trackskew: 0
> cylinderskew: 0
> headswitch: 0         # microseconds
> track-to-track seek: 0        # microseconds
> drivedata: 0 
> 
> 15 partitions:
> #             size        offset  fstype [fsize bsize  cpg]
>   c:      71681967            63  unused      0     0      # Cyl     0*-  
> 4461 
>   d:       2104452            63  4.2BSD   2048 16384  132 # Cyl     0*-   
> 130 
>   e:       8385930       2104515  4.2BSD   2048 16384  328 # Cyl   131 -   
> 652 
>   f:      23294250      48387780  4.2BSD   2048 16384  328 # Cyl  3012 -  
> 4461 
>   h:       4112640      15936480  4.2BSD   2048 16384  256 # Cyl   992 -  
> 1247 
>   i:       2104515      40933620  4.2BSD   2048 16384    1 # Cyl  2548 -  
> 2678 
>   j:      18828180      20049120  4.2BSD   2048 16384  328 # Cyl  1248 -  
> 2419 
>   k:       5349645      43038135  4.2BSD   2048 16384   16 # Cyl  2679 -  
> 3011 
>   l:       2056320      38877300  4.2BSD   2048 16384  128 # Cyl  2420 -  
> 2547 
>   m:       2104515      10490445  4.2BSD   2048 16384  132 # Cyl   653 -   
> 783 
>   n:       2056320      12594960  4.2BSD   2048 16384    1 # Cyl   784 -   
> 911 
> *----------------------------------------------------------------------*
> OpenBSD 4.1-current (GENERIC) #255: Thu Jun  7 18:56:14 MDT 2007
>     [EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/GENERIC
> cpu0: Intel(R) Pentium(R) 4 CPU 1500MHz ("GenuineIntel" 686-class) 1.50 GHz
> cpu0: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM
> real mem  = 804384768 (767MB)
> avail mem = 766832640 (731MB)
> mainbus0 at root
> bios0 at mainbus0: AT/286+ BIOS, date 06/06/01, BIOS32 rev. 0 @ 0xffe90, 
> SMBIOS rev. 2.3 @ 0xf0450 (97 entries)
> bios0: Dell Computer Corporation Precision 330
> apm0 at bios0: Power Management spec V1.2
> apm0: AC on, battery charge unknown
> apm0: flags 30102 dobusy 0 doidle 1
> pcibios0 at bios0: rev 2.1 @ 0xf0000/0x10000
> pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfbbb0/176 (9 entries)
> pcibios0: PCI Interrupt Router at 000:31:0 ("Intel 82801BA LPC" rev 0x00)
> pcibios0: PCI bus #2 is the last bus
> bios0: ROM list: 0xc0000/0xa800 0xca800/0x5800
> cpu0 at mainbus0
> pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
> pchb0 at pci0 dev 0 function 0 "Intel 82850 Host" rev 0x02
> ppb0 at pci0 dev 1 function 0 "Intel 82850/82860 AGP" rev 0x02
> pci1 at ppb0 bus 1
> vga1 at pci1 dev 0 function 0 "NVIDIA Vanta" rev 0x15
> wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
> ppb1 at pci0 dev 30 function 0 "Intel 82801BA AGP" rev 0x04
> pci2 at ppb1 bus 2
> fxp0 at pci2 dev 8 function 0 "Intel 8255x" rev 0x05, i82558: irq 10, address 
> 00:90:27:86:21:9c
> inphy0 at fxp0 phy 1: i82555 10/100 PHY, rev. 0
> ahc0 at pci2 dev 10 function 0 "Adaptec AHA-2940U2 U2" rev 0x00: irq 11
> scsibus0 at ahc0: 16 targets
> sd0 at scsibus0 targ 0 lun 0: <SEAGATE, ST39102LW, 0005> SCSI2 0/direct fixed
> sd0: 8683MB, 6962 cyl, 12 head, 212 sec, 512 bytes/sec, 17783240 sec total
> sd1 at scsibus0 targ 2 lun 0: <SEAGATE, ST336705LW, 5063> SCSI3 0/direct fixed
> sd1: 35003MB, 19036 cyl, 8 head, 470 sec, 512 bytes/sec, 71687370 sec total
> cd0 at scsibus0 targ 4 lun 0: <YAMAHA, CRW8824S, 1.00> SCSI2 5/cdrom removable
> cd1 at scsibus0 targ 6 lun 0: <TEAC, CD-ROM CD-532S, 1.0A> SCSI2 5/cdrom 
> removable
> ichpcib0 at pci0 dev 31 function 0 "Intel 82801BA LPC" rev 0x04: 24-bit timer 
> at 3579545Hz
> pciide0 at pci0 dev 31 function 1 "Intel 82801BA IDE" rev 0x04: DMA, channel 
> 0 wired to compatibility, channel 1 wired to compatibility
> wd0 at pciide0 channel 0 drive 0: <IC35L040AVER07-0>
> wd0: 16-sector PIO, LBA, 38166MB, 78165360 sectors
> wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
> pciide0: channel 1 ignored (disabled)
> uhci0 at pci0 dev 31 function 2 "Intel 82801BA USB" rev 0x04: irq 11
> ichiic0 at pci0 dev 31 function 3 "Intel 82801BA SMBus" rev 0x04: irq 10
> iic0 at ichiic0
> uhci1 at pci0 dev 31 function 4 "Intel 82801BA USB" rev 0x04: irq 9
> auich0 at pci0 dev 31 function 5 "Intel 82801BA AC97" rev 0x04: irq 10, ICH2 
> AC97
> ac97: codec id 0x41445360 (Analog Devices AD1885)
> ac97: codec features headphone, Analog Devices Phat Stereo
> audio0 at auich0
> isa0 at ichpcib0
> isadma0 at isa0
> pckbc0 at isa0 port 0x60/5
> pckbd0 at pckbc0 (kbd slot)
> pckbc0: using irq 1 for kbd slot
> wskbd0 at pckbd0: console keyboard, using wsdisplay0
> pmsi0 at pckbc0 (aux slot)
> pckbc0: using irq 12 for aux slot
> wsmouse0 at pmsi0 mux 0
> pcppi0 at isa0 port 0x61
> midi0 at pcppi0: <PC speaker>
> spkr0 at pcppi0
> lpt0 at isa0 port 0x378/4 irq 7
> npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
> pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
> pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
> fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
> fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
> usb0 at uhci0: USB revision 1.0
> uhub0 at usb0: Intel UHCI root hub, rev 1.00/1.00, addr 1
> usb1 at uhci1: USB revision 1.0
> uhub1 at usb1: Intel UHCI root hub, rev 1.00/1.00, addr 1
> biomask ef65 netmask ef65 ttymask ffe7
> pctr: user-level cycle counter enabled
> mtrr: Pentium Pro MTRR support
> softraid0 at root
> ahc0: target 0 using 16bit transfers
> ahc0: target 0 synchronous at 20.0MHz, offset = 0xf
> ahc0: target 2 using 16bit transfers
> ahc0: target 2 synchronous at 20.0MHz, offset = 0x3f
> dkcsum: sd0 matches BIOS drive 0x80
> dkcsum: wd0 matches BIOS drive 0x81
> root on sd0a swap on sd0b dump on sd0b
> *----------------------------------------------------------------------*

Reply via email to