i just noticed an obvious stupid mistake of mine, the 'dd' should go before
the 'fdisk' as well (for the same reason as 'disklabel').

On Tue, 04 Nov 2014 07:04:23 -0500 [email protected] wrote:
> yes, you are zeroing the whole disklabel, which is located in the openbsd area
> starting at 32k (or 64 sectors). make sure you do the 'disklabel' AFTER 'dd'.
> 
> if you do a 'dd if=/dev/sd0c bs=512 skip=64 count=2 | strings' and you should
> see the disk's model number (after the disklabel has been configured of 
> course).
> 
> i have a script with a procedure that works consistently, which does the
> following:
> 

this:

> fdisk -iy $DISK
> 
> #clear old softraid data
> dd if=/dev/zero of=/dev/r${DISK}c bs=1m count=1

should be this:

  #clear old softraid data
  dd if=/dev/zero of=/dev/r${DISK}c bs=1m count=1

  fdisk -iy $DISK


> #clear the disklabel and add raid partition
> echo "z\na\n\n\n\nRAID\nw\nq\n\n" | disklabel -E $DISK >/dev/null
> 
> #create softraid device
> bioctl -c C -l /dev/${DISK}a softraid0
> 
> dd if=/dev/zero of=/dev/r${SRDISK}c bs=1m count=1
> fdisk -iy $SRDISK
> disklabel -E $SRDISK
> newfs ...
> 
> where $DISK is your disk (sd0 in your case), and $SRDISK is the softraid dev
> created by bioctl (maybe sd1, watch bioctl's output)
> 
> On Mon, 3 Nov 2014 22:33:45 -0500 Jonathan Thornburg 
> <[email protected]> wrote:
> > I'm trying to set up 5.6/amd64 on a new-from-the-factory 750GB disk
> > which I've just had installed in a Thinkpad T60.  (This Thinkpad had
> > previously been running 5.5/amd64 using an older/smaller disk, with
> > no problems).
> > 
> > I want to try having the entire new disk secured with softraid crypto.
> > So, I booted the Thinkpad (with the new disk installed) from my 5.6/amd64
> > CD (dmesg below) and dropped into the shell.  The dmesg shows that the
> > bsd.rd kernel detected the new disk as sd0.
> > 
> > To try to set up the new disk, I first did
> > # fdisk -i sd0
> > to set up the MBR partitions, then
> > # disklabel -E sd0
> > to add a single 'a' partition of type 'RAID' containing all the space
> > after the first 64 sectors (reserved as per "Disklabel tricks and tips"
> > in section 14.3 of the OpenBSD FAQ).  So far so good:
> > 
> > # fdisk sd0
> > Disk: sd0   geometry: 91201/255/63 [1465149168 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: A6      0   1   2 -  91200 254  63 [          64:  1465144001 ] OpenBSD 
> >     
> > # disklabel sd0
> > # /dev/rsd0c:
> > type: SCSI
> > disk: SCSI disk
> > label: WDC WD7500BPKX-2
> > duid: 407d46caba526d90
> > flags:
> > bytes/sector: 512
> > sectors/track: 63
> > tracks/cylinder: 255
> > sectors/cylinder: 16065
> > cylinders: 91201
> > total sectors: 1465149168
> > boundstart: 64
> > boundend: 1465144065
> > drivedata: 0 
> > 
> > 16 partitions:
> > #                size           offset  fstype [fsize bsize  cpg]
> >   a:       1465144001               64    RAID                   
> >   c:       1465149168                0  unused                   
> > #
> > 
> > Next I tried to follow the instructions in section 14.21 of the FAQ
> > and zero the first megabyte of the new partition:
> > 
> > # dd if=/dev/zero bs=1m count=1 of=/dev/rsd0a
> > 
> > Now the "strange behavior":  Checking the output of fdisk and disklabel
> > again as a sanity check, I find that the fdisk output is unchanged (as it
> > should be!), but disklabel now shows that the newly-created 'a' partition
> > has vanished, and the duid has been zeroed:
> > 
> > # disklabel sd0
> > # /dev/rsd0c:
> > type: SCSI
> > disk: SCSI disk
> > label: WDC WD7500BPKX-2
> > duid: 0000000000000000
> > flags:
> > bytes/sector: 512
> > sectors/track: 63
> > tracks/cylinder: 255
> > sectors/cylinder: 16065
> > cylinders: 91201
> > total sectors: 1465149168
> > boundstart: 64
> > boundend: 1465144065
> > drivedata: 0 
> > 
> > 16 partitions:
> > #                size           offset  fstype [fsize bsize  cpg]
> >   c:       1465149168                0  unused                   
> > #
> > 
> > It's as if the 'a' partition I created (which started at offset 64) was
> > actually overlapping the disklabel metadata!
> > 
> > One other data point: I also saw the same behavior ('a' partition gone,
> > duid zeroed) when I repeated the same commands but with the (recreated)
> > 'a' partition having the default '4.2BSD' fstype instead of 'RAID'.
> > 
> > Can anyone clue me in as to what's I'm doing wrong?
> > 
> > I thought I understood disk partitioning (and I'm fully aware that
> > overlapping partitions are doubleplusungood!), but I have the feeling
> > I'm missing something obvious here....
> > 
> > --- begin dmesg ---
> > OpenBSD 5.6 (RAMDISK_CD) #303: Fri Aug  8 00:25:26 MDT 2014
> >     [email protected]:/usr/src/sys/arch/amd64/compile/RAMDISK_CD
> > real mem = 3203203072 (3054MB)
> > avail mem = 3112607744 (2968MB)
> > mainbus0 at root
> > bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0010 (68 entries)
> > bios0: vendor LENOVO version "7IET23WW (1.04 )" date 12/27/2006
> > bios0: LENOVO 87424GU
> > acpi0 at bios0: rev 2
> > acpi0: sleep states S0 S3 S4 S5
> > acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG HPET SLIC BOOT SSDT SSDT 
> > SSDT SSDT
> > acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
> > cpu0 at mainbus0: apid 0 (boot processor)
> > cpu0: Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz, 1995.33 MHz
> > cpu0: 
> > FPU,VME,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,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF
> > cpu0: 4MB 64b/line 16-way L2 cache
> > cpu0: apic clock running at 166MHz
> > cpu at mainbus0: not configured
> > ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins
> > ioapic0: misconfigured as apic 2, remapped to apid 1
> > acpi0: WARNING EC not initialized
> > acpi0: WARNING EC not initialized
> > acpi0: WARNING EC not initialized
> > acpi0: WARNING EC not initialized
> > acpi0: WARNING EC not initialized
> > acpiprt0 at acpi0: bus 0 (PCI0)
> > acpiprt1 at acpi0: bus 1 (AGP_)
> > acpiprt2 at acpi0: bus 2 (EXP0)
> > acpiprt3 at acpi0: bus 3 (EXP1)
> > acpiprt4 at acpi0: bus 4 (EXP2)
> > acpiprt5 at acpi0: bus 12 (EXP3)
> > acpiprt6 at acpi0: bus 21 (PCI1)
> > pci0 at mainbus0 bus 0
> > pchb0 at pci0 dev 0 function 0 "Intel 82945GM Host" rev 0x03
> > ppb0 at pci0 dev 1 function 0 "Intel 82945GM PCIE" rev 0x03: msi
> > pci1 at ppb0 bus 1
> > vga1 at pci1 dev 0 function 0 "ATI Radeon Mobility X1400" rev 0x00
> > wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> > "Intel 82801GB HD Audio" rev 0x02 at pci0 dev 27 function 0 not configured
> > ppb1 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x02: msi
> > pci2 at ppb1 bus 2
> > em0 at pci2 dev 0 function 0 "Intel 82573L" rev 0x00: msi, address 
> > 00:16:41:e4:89:7b
> > ppb2 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x02: msi
> > pci3 at ppb2 bus 3
> > athn0 at pci3 dev 0 function 0 "Atheros AR5418" rev 0x01: apic 1 int 17
> > athn0: MAC AR5418 rev 2, RF AR5133 (2T3R), ROM rev 3, address 
> > 00:19:7e:6d:f9:88
> > ppb3 at pci0 dev 28 function 2 "Intel 82801GB PCIE" rev 0x02: msi
> > pci4 at ppb3 bus 4
> > ppb4 at pci0 dev 28 function 3 "Intel 82801GB PCIE" rev 0x02: msi
> > pci5 at ppb4 bus 12
> > uhci0 at pci0 dev 29 function 0 "Intel 82801GB USB" rev 0x02: apic 1 int 16
> > uhci1 at pci0 dev 29 function 1 "Intel 82801GB USB" rev 0x02: apic 1 int 17
> > uhci2 at pci0 dev 29 function 2 "Intel 82801GB USB" rev 0x02: apic 1 int 18
> > uhci3 at pci0 dev 29 function 3 "Intel 82801GB USB" rev 0x02: apic 1 int 19
> > ehci0 at pci0 dev 29 function 7 "Intel 82801GB USB" rev 0x02: apic 1 int 19
> > usb0 at ehci0: USB revision 2.0
> > uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
> > ppb5 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xe2
> > pci6 at ppb5 bus 21
> > cbb0 at pci6 dev 0 function 0 "TI PCI1510 CardBus" rev 0x00: apic 1 int 16
> > cardslot0 at cbb0 slot 0 flags 0
> > cardbus0 at cardslot0: bus 22 device 0 cacheline 0x8, lattimer 0xb0
> > pcmcia0 at cardslot0
> > "Intel 82801GBM LPC" rev 0x02 at pci0 dev 31 function 0 not configured
> > pciide0 at pci0 dev 31 function 1 "Intel 82801GB IDE" rev 0x02: DMA, 
> > channel 0 configured to compatibility, channel 1 configured to compatibility
> > atapiscsi0 at pciide0 channel 0 drive 0
> > scsibus0 at atapiscsi0: 2 targets
> > cd0 at scsibus0 targ 0 lun 0: <HL-DT-ST, DVDRAM GSA-4083N, 1.00> ATAPI 
> > 5/cdrom removable
> > cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
> > pciide0: channel 1 ignored (disabled)
> > ahci0 at pci0 dev 31 function 2 "Intel 82801GBM AHCI" rev 0x02: msi, AHCI 
> > 1.1
> > scsibus1 at ahci0: 32 targets
> > sd0 at scsibus1 targ 0 lun 0: <ATA, WDC WD7500BPKX-2, 01.0> SCSI3 0/direct 
> > fixed naa.50014ee604d7ebda
> > sd0: 715404MB, 512 bytes/sector, 1465149168 sectors
> > "Intel 82801GB SMBus" rev 0x02 at pci0 dev 31 function 3 not configured
> > usb1 at uhci0: USB revision 1.0
> > uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
> > usb2 at uhci1: USB revision 1.0
> > uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
> > usb3 at uhci2: USB revision 1.0
> > uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
> > usb4 at uhci3: USB revision 1.0
> > uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
> > isa0 at mainbus0
> > 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
> > softraid0 at root
> > scsibus2 at softraid0: 256 targets
> > root on rd0a swap on rd0b dump on rd0b
> > --- end dmesg ---
> > 
> > thanks,
> > 
> > -- 
> > -- "Jonathan Thornburg [remove -animal to reply]" 
> > <[email protected]>
> >    Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
> >    "There was of course no way of knowing whether you were being watched
> >     at any given moment.  How often, or on what system, the Thought Police
> >     plugged in on any individual wire was guesswork.  It was even 
> > conceivable
> >     that they watched everybody all the time."  -- George Orwell, "1984"

Reply via email to